0

I am having an issue with this JSON file. I cannot seem to find out what I did wrong. I was told my formatting was incorrect by a friend but cannot seem to find out how I went wrong.

Would anybody be able to point out the flaw in my formatting and explain so I can prevent this from happening on further projects?

http://pastebin.com/nzTrPvMd

This is the pastebin file

2 Answers 2

1

The mapping in the middle of the file is weird:

{
        "Username":"CENSORED", "CENSORED",

A key (like "Username") can only have one value. You appear to be trying to store two here. Mappings look like this:

{
    "key": "a value",
    "another key": "another value",
    "number of things": 4,
}

Keys must be strings, but values can be any JSON type. You can, for example, have a key point to a list:

"Username": ["CENSORED", "CENSORED"]

Or a mapping with descriptive keys, if a list isn't appropriate:

"Username": {
    "FirstName": "CENSORED",
    "LastName": "CENSORED"
}
Sign up to request clarification or add additional context in comments.

Comments

0

in JSON, square brackets [] indicates an array as a list. A JSON list never contains associative keys, here valid examples:

["first", "second", "third"]
[{"id":"1"}, {"id", "2"}]

Braces indicate an array as an object that could contain nothing or N pair of values ("key":"value"). an example:

{"id":"1"}
{"name":"john", "age":"12"}
{} (empty object)

Follow this easy instruction and you'll make valid JSON every time

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.