JSON processing in Python: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
=External= | |||
* https://realpython.com/python-json/ | |||
=Internal= | =Internal= | ||
* [[Python Code Examples#Code_Examples|Python Code Examples]] | * [[Python Code Examples#Code_Examples|Python Code Examples]] |
Revision as of 01:06, 9 March 2022
External
Internal
Overview
import json
data = json.loads('{"color":"blue", "size":10, "details":{"shape":{"texture":"bumpy", "orientation":"vertical"}}}')
print(data.get("color")) # displays blue
print(data["color"]) # displays blue
print(data.get("size")) # displays 10
print(data["details"]["shape"]["texture"]) # displays bumpy
Suggestions on how to safely recursively navigate a complex data structure: