pizzae
pizzae

Reputation: 3025

Error inserting data into mongodb using robomongo

So this is my original data:

{
"_id" : "AHRLArFtRRWLp6knp",
"name" : "BlueCorp Steel inc.",
"subEnd" : ISODate("2017-04-21T14:00:00.000Z"),
"type" : "Enterprise",
"visions" : [ 
]
}

Now when I try to edit it, to make it so that I get this:

{
"_id" : "AHRLArFtRRWLp6knp",
"name" : "BlueCorp Steel inc.",
"subEnd" : ISODate("2017-04-21T14:00:00.000Z"),
"type" : "Enterprise",
"visions" : [ 
    {
        "refId" : 0,
        "order" : 0,
    }, 
    {
        "refId" : 1,
        "order" : 1,
    }
]
}

I'm getting this error:

Unable to parse JSON:
First character in field must be [A-Za-z$_], at (10, 9)

Its roughly pointing to the "},"

Can someone please help me? Idk why im getting this dumb error, where adding an array should be a trivial thing

Upvotes: 1

Views: 768

Answers (1)

chridam
chridam

Reputation: 103365

Your JSON is invalid, remove the extra commas in

{
    "refId" : 0,
    "order" : 0, // <-- remove
}, 
{
    "refId" : 1,
    "order" : 1, // <-- remove
}

so that becomes

{
    "refId" : 0,
    "order" : 0
}, 
{
    "refId" : 1,
    "order" : 1
}

Upvotes: 2

Related Questions