JSON processing in Python: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
=Internal=
=Internal=
* [[Python#Code_Examples|Python]]
* [[Python#Code_Examples|Python]]
* [[Python Module json]]
=Overview=
=Overview=
<syntaxhighlight lang='python'>
<syntaxhighlight lang='python'>

Revision as of 07:47, 12 January 2022

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