Answers for "getting length of json object"

4

json object length in javascript

const data = { a : 'b', c : 'd' };

const length = Object.keys(data).length;

//Length is 2
Posted by: Guest on September-30-2020
0

length of json object python

import json

json_data = json.dumps({
  "result":[
    {
      "run":[
        {
          "action":"stop"
        },
        {
          "action":"start"
        },
        {
          "action":"start"
        }
      ],
      "find": "true"
    }
  ]
})

item_dict = json.loads(json_data)
print len(item_dict['result'][0]['run'])
Posted by: Guest on October-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language