Reputation: 14925
I am writing a json file, but I am getting errors when I try to validate it online. What is wrong with the code ?
"document":
{
"2009":
[
{
"id": 1,
"name": "2009 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
},
{
"id": 10,
"name": "2009 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
],
"2010":
[
{
"id": 2,
"name": "2010 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
],
"2011":
[
{
"id": 1,
"name": "2011 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
]
}
Upvotes: 0
Views: 94
Reputation: 471
you just forgot to put the curly brace at the begining of the array. Now your code look like.
**{**
"document":
[
{ "2009":
[
{
"id": 1,
"name": "2009 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
},
{
"id": 10,
"name": "2009 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
],
"2010":
[
{
"id": 2,
"name": "2010 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
],
"2011":
[
{
"id": 1,
"name": "2011 Annual Report",
"version": 2,
"timestamp": 1222222,
"sessions": [
]
}
]
}
]
**}**
Check it. You got my point?
Upvotes: 0
Reputation: 32052
Even the top-level object has to start and end with braces:
{
"document": {
"2009": [
...
]
}
}
Upvotes: 4