JSON not formatted correctly
JSON is a key/value format. Your issue is that the arrays are inside of curly brackets ({}
) which makes them a key, with no value.
"Company1": { <-- Curly Bracket (Implies that data is in form of a hash (key/value) )
[
{
"PayCode": "SCK",
"AbsenceType": "Illness"
},
{
"PayCode": "VAC",
"AbsenceType": "Vacation"
},
{
"PayCode": "BRV",
"AbsenceType": "Bereavement"
},
{
"PayCode": "JUR",
"AbsenceType": "Jury Duty"
},
{
"PayCode": "PER",
"AbsenceType": "Personal"
}
] <-- key ends with no value.
},
I think you need to store the array for company one as just the array like so:
"Company1": [ <-- The array is the value for company1
{
"PayCode": "SCK",
"AbsenceType": "Illness"
},
{
"PayCode": "VAC",
"AbsenceType": "Vacation"
},
{
"PayCode": "BRV",
"AbsenceType": "Bereavement"
},
{
"PayCode": "JUR",
"AbsenceType": "Jury Duty"
},
{
"PayCode": "PER",
"AbsenceType": "Personal"
}
] <-- key ends with no value.
This would be your whole file:
[
{
"Company1":[
{
"PayCode": "SCK",
"AbsenceType": "Illness"
},
{
"PayCode": "VAC",
"AbsenceType": "Vacation"
},
{
"PayCode": "BRV",
"AbsenceType": "Bereavement"
},
{
"PayCode": "JUR",
"AbsenceType": "Jury Duty"
},
{
"PayCode": "PER",
"AbsenceType": "Personal"
}
],
"Company2":[
{
"PayCode": "SCK",
"AbsenceType": "Sick"
},
{
"PayCode": "VAC",
"AbsenceType": "Vacation"
},
{
"PayCode": "BRV",
"AbsenceType": "Bereavement"
},
{
"PayCode": "JUR",
"AbsenceType": "Jury Duty"
},
{
"PayCode": "PER",
"AbsenceType": "Personal"
},
{
"PayCode": "PRNU",
"AbsenceType": "Personal"
}
]
}
]