Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "192.168.0.129": {
- "username": "me",
- "streaming": "Spotify",
- "name": "John",
- "email": "john@gmail.com"
- }
- }
- new_data = {'next_songs': ['song1', 'song2']}
- with open('c.json', 'r') as json_data:
- data = json.load(json_data)
- data.update(new_data)
- with open('c.json', 'w') as json_data:
- json.dump(data, json_data, indent=4)
- {
- "new_data": [
- "song1",
- "song2"
- ],
- "192.168.0.129": {
- "username": "me",
- "streaming": "Spotify",
- "name": "John",
- "email": "john@gmail.com"
- }
- }
- {
- "192.168.0.129": {
- "username": "me",
- "streaming": "Spotify",
- "name": "John",
- "email": "john@gmail.com"
- "new_data": ["song1", "song2"],
- }
- }
Add Comment
Please, Sign In to add comment