User Tools

Site Tools


python:jsonprocessing

Python Json

Simple Example

Parse Json String (Json Decoder)

  • Performs the following translations in decoding by default:
JSONPython
objectdict
arraylist
stringunicode
number (int)int, long
number (real)float
trueTrue
falseFalse
nullNone
  • Simple example for parsing Json:
    import json
    json_string = '{"first_name": "Guido", "last_name":"Rossum"}'
    parsed_json = json.loads(json_string)
    print parsed_json

    output:return python object

    {u'first_name': u'Guido', u'last_name': u'Rossum'}

    And we can access the property first_name with command:

    print parsed_json['first_name']

Create Json String(Json Encoder)

  • Supports the following objects and types by default:
PythonJSON
dictobject
list, tuplearray
str, unicodestring
int, long, floatnumber
Truetrue
Falsefalse
Nonenull
  • Simple Example

Json to csv

python/jsonprocessing.txt · Last modified: 2022/10/29 16:15 by 127.0.0.1