'Getting data into a json skeleton through user inputs in python

Say I have an input skeleton like this

    "thing": {
        "name": "",
        "date": ""
    },
    "anotherThing": [
        {
            "name": "",
            "description": "",
            "expirationDate": ""
       
        }
    ],

How would I go about filling in the blanks through user inputs so it could look something like this?

    "thing": {
        "name": "Water",
        "date": "07/27/2022"
    },
    "anotherThing": [
        {
            "name": "Fire",
            "description": "is hot",
            "expirationDate": "05/22/2026"
       
        }
    ],

or something like that above depending on what the user inputs?



Solution 1:[1]

you would need to write the JSON as a file


data = {
  'message': converted,

}
with open('data.json', 'w', encoding='utf-8') as f:
  json.dump(data, f, ensure_ascii=False, indent=4)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TIBTHINK