Reputation: 925
I am trying to construct a JSON formats follows but running into below error, what is wrong with the below format and how to fix it?
{
project_sha_list: [{
project: project1
sha: sha1
},
{
project: project2
sha: sha2
}
]
train: train1
}
ERROR:-
Error: Parse error on line 1:
{ project_sha_list: [{
--^
Expecting 'STRING', '}', got 'undefined'
Upvotes: -1
Views: 254
Reputation: 40078
JSON keys and string values must be in quotes like below, but if the value is integer,double,long then it should not be enclosed in quotes, and if you have multiple properties each property should end with ,
except last one
{
"project_sha_list": [
{
"project": "project1",
"sha": "sha1"
},
{
"project": "project2",
"sha": "sha2"
}
],
"train": "train1"
}
Upvotes: 2
Reputation: 97
The correct jain format is:
{
"project_sha_list": [
{ "project": "project1", "sha": "sha1" },
{ "project": "project2", "sha": "sha2" }
],
"train": "train1"
}
Upvotes: 0
Reputation: 3349
Your JSON should be:
{
"project_sha_list": [
{
"project": "project1",
"sha": "sha1"
},
{
"project": "project2",
"sha": "sha2"
}
],
"train": "train1"
}
You can validate it here
you keys and values both should be within "
Upvotes: 1
Reputation: 2684
Try this format:
{
"project_sha_list": [
{
"project": project1,
"sha": sha1
},
{
"project": project2,
"sha": sha2
}
],
"train": train1
}
Upvotes: 0