I am writing a JSON file, but I am not sure about which of the following formats is the correct one?
Quoting variable names and all string values
{
"class": {
"number": 2,
"student": {
"name": "Tom",
"age": 1
},
"student": {
"name": "May",
"age": 2
}
}
}
or
Quoting only string values
{
class: {
number: 2,
student: {
name: "Tom",
age: 1
},
student:
{
name: "May",
age: 2
}
}
}
The first is valid, if you’re unaware you can validate your JSON output online pretty easily here: http://www.jsonlint.com/