How to loop through JSON array?

前端 未结 8 1638
鱼传尺愫
鱼传尺愫 2020-12-01 14:52

I have some JSON-code which has multiple objects in it:

[
    {
        \"MNGR_NAME\": \"Mark\",
        \"MGR_ID\": \"M44\",
        \"EMP_ID\": \"1849\"
           


        
8条回答
  •  粉色の甜心
    2020-12-01 15:30

    You could use $.each or $.grep, if you also want to get the elements that contain the attribute.

    filtered = $.grep(result, function(value) {
        return (value["MNGR_NAME"] !== undefined)
    });
    count = filtered.length
    

提交回复
热议问题