get json from file python
import json
with open('path_to_file/person.json') as f:
data = json.load(f)
print(data)import json
data = {}
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
import json
data = {}
data['people'] = []
data['people'].append({
'name': 'Scott',
'website': 'stackabuse.com',
'from': 'Nebraska'
})
data['people'].append({
'name': 'Larry',
'website': 'google.com',
'from': 'Michigan'
})
data['people'].append({
'name': 'Tim',
'website': 'apple.com',
'from': 'Alabama'
})
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
import json
with open('data.txt') as json_file:
data = json.load(json_file)
for p in data['people']:
print('Name: ' + p['name'])
print('Website: ' + p['website'])
print('From: ' + p['from'])
print('')
Also in JavaScript:
- flutter reorder map by key
- object to query string javascript
- jquery dynamic event handling
- pop up notification using jquery
- angularjs dropdown
- destruction in javascript
- vue axios catch error
- javascript detect square number
- check if js property exists in class
- check if word is in string javascript
- javascript declare empty array
- angular component lifecycle hooks
- console table javascript
- regular expression escape character
- js throw custom error
- canvas cut path to image
- isDate javascript
- javascript get url path
- trigger play video jquery
- js keycodes
- count number of times an element is occuring in an array in javascript
- jquery delay to call function
- js get first letter of string
- installing node on ec2 instance