Learn Courses My Dashboard

M2L11 JSON quotation issues?

Can someone tell me the difference between:

[
{
“name”:“Meatlovers”,
“Toppings”:“Something”
},
{
“name”:“Hawaiian”,
“Toppings”:“Something”
},
{
“name”:“Supreme”,
“Topping”:“Something”
}
]

and


[
{
“name”:“Meatlovers”,
“Toppings”:“Something”
},
{
“name”:“Hawaiian”,
“Toppings”:“Something”
},
{
“name”:“Supreme”,
“Topping”:“Something”
}
]

The first one is the one I typed in, that keeps having validation issues, and the 2nd one is the one it keeps correcting for me, but not sure why

They are identical.

However, what we see here may not be exactly the data you are dealing with, due to not correctly placing them inside backticks ``` to properly format the code, so the forums software mungs things up, like quote marks.

Try posting your JSON again wrapped in backticks ``` and we can see if there is any difference then.

Copy your JSON into a JSON validator online and see what that says.

Also quotation marks sometimes can cause issues if you copy code directly from the web into an IDE
Try retyping any quote mark where an error may pop up

This was the problem I was having. Was the quotation marks. I created a Json file on Xcode after and it worked and auto filled a lot of things. But when I used text editor as the challenge suggested, I had tons of problems even though all syntax was identical.

Your text editor may be “smartening” the quotation marks, which the JSON format doesn’t like.

That’s what I meant when I said this:

However, what we see here may not be exactly the data you are dealing with, due to not correctly placing them inside backticks ``` to properly format the code, so the forums software mungs things up, like quote marks.

Since you didn’t post your original code in backticks ```, all the quotation marks were “helpfully” smartened up by the forum software and your two samples are identical. But if the ones you typed directly in Xcode had “dumb” quotes and the ones you typed in an external text editor had “smart” quotes, then they wouldn’t match.

How does one use dumb quotations vs smart?

That depends on what software you are using to write the text file. If it’s an application that allows the user to select which kind of quotes they want, it should be somewhere in the preferences.