Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

# write json file

# write json file
import json
d = {
    "firstName": "Tom",
    "lastName": "Jack",
    "gender": "male",
    "age": 35,
    "address": {
        "streetAddress": "126",
        "city": "San Jone",
        "state": "CA",
        "postalCode": "95150"
    },
    "phoneNumbers": [
        { "type": "home", "number": "4083627627" }
    ]
}

filename = "/content/sample_data/sample1.json"
with open(filename, 'w') as f:
  json.dump(d, f)
  
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #write #json #file
ADD COMMENT
Topic
Name
1+1 =