User Tools

Site Tools


help:python:data_class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
help:python:data_class [2020/08/11 14:58] – [Data Class in Python] gerhardhelp:python:data_class [2020/08/11 15:04] (current) – [Data Class in Python] gerhard
Line 75: Line 75:
 </WRAP> </WRAP>
  
 +<code python>
 +
 +import json
 +
 +json.dumps(dict(data),indent=2)
 +
 +</code>
 +
 +The resulting output is:
 +
 +<code json>
 +{
 +  "c": {
 +    "val3": 789,
 +    "str3": "ghi"
 +  },
 +  "a": {
 +    "val1": 123,
 +    "str1": "abc"
 +  },
 +  "b": {
 +    "val2": 456,
 +    "str2": "def"
 +  }
 +}
 +</code>
  
help/python/data_class.1597157892.txt.gz · Last modified: 2020/08/11 14:58 by gerhard