How do I add information to a JSON file via python | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How do I add information to a JSON file via python

Hello, I've been struggling to find a way to add information to a JSON file. I intend on doing this more actively so adding the information when the script initially runs isn't exactly ideal but may help. The JSON file should look like this afterward with the username and the user's info (multiple users will be stored)being added to the file post start(fair warning I'm quite new and my syntax is probably horrid) "Users": { "username1": [ { "data1": "info", "data2": "info", } ] }

13th Nov 2020, 8:12 PM
Ben Broz
Ben Broz - avatar
1 Respuesta
+ 3
Typically, you'll use the JSON module to work with JSON and JSON files. Here is some info. Hopefully this will help. https://docs.python.org/3/library/json.html https://realpython.com/python-json/ https://www.programiz.com/python-programming/json
14th Nov 2020, 1:58 AM
ChaoticDawg
ChaoticDawg - avatar