Answers for "python serialize"

0

python serialize

import json
info = {
    "data": {
        "name": "Dave",
        "City": "NY"
    }
}
# With json.dump  (into file)
with open( "data.json" , "w" ) as x:
    json.dump( info , x )
# >>> {"data": {"name": "Dave", "City": "NY"}}

# with json.dumps (object)
data = json.dumps( info )
print( data )
# >>> {"data": {"name": "Dave", "City": "NY"}}
Posted by: Guest on April-19-2021

Python Answers by Framework

Browse Popular Code Answers by Language