Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 442 Bytes

how-to-query-json.md

File metadata and controls

25 lines (20 loc) · 442 Bytes

How to query json

import json
data = json.loads('{"ids":{"id":"5"}}')
id = data['ids']['id']
  • import json - library to operate with json
  • json.loads - parse json string into object
  • data['ids']['id'] - query value of the nested element the same was as we query dictionary

group: json

Example:

import json
data = json.loads('{"ids":{"id":"5"}}')
id = data['ids']['id']
print(id)
5