How to loop through JSON array?

前端 未结 8 1636
鱼传尺愫
鱼传尺愫 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:44

    You need to access the result object on iteration.

    for (var key in result)
    {
       if (result.hasOwnProperty(key))
       {
          // here you have access to
          var MNGR_NAME = result[key].MNGR_NAME;
          var MGR_ID = result[key].MGR_ID;
       }
    }
    

提交回复
热议问题