I am trying to add year and month to a json file so i can group all parties and events into a month with out having to place this information in each event but when I add it at the top of file it wont parse I am having a syntax issue some where here.
{
"year": 2023,
"month": 12
{
"Parties": [
{
"Event1": 67.7,
"Event2": 5.1,
"Event3": 3.3
},
{
"Event1": 89.7,
"Event2": 4.3,
"Event3": 3.2
},
{
"Event1": 69.3,
"Event2": 4.2,
"Event3": 0.0
}
]
}
}
>Solution :
There is a typo (comma is missing after month) and extra curly bracket { you have.
The working JSON is:
{
"Year": 2023,
"Month": 12,
"Parties": [
{
"Event1": 67.7,
"Event2": 5.1,
"Event3": 3.3
},
{
"Event1": 89.7,
"Event2": 4.3,
"Event3": 3.2
},
{
"Event1": 69.3,
"Event2": 4.2,
"Event3": 0
}
]
}
or if you want to use nested JSON, then add a property name before "Parties"
{
"Year": 2023,
"Month": 12,
"PartyData": {
"Parties": [
{
"Event1": 67.7,
"Event2": 5.1,
"Event3": 3.3
},
{
"Event1": 89.7,
"Event2": 4.3,
"Event3": 3.2
},
{
"Event1": 69.3,
"Event2": 4.2,
"Event3": 0
}
]
}
}