1
I would like to use this code on the site myjson.com but give me the error Error: Your JSON appears to be invalid.
. How should I do?
[{
"imagem": '<a href="http://bit.ly/1r1QIF4" target="_blank">Clique aqui para ver o local</a>'
}]
1
I would like to use this code on the site myjson.com but give me the error Error: Your JSON appears to be invalid.
. How should I do?
[{
"imagem": '<a href="http://bit.ly/1r1QIF4" target="_blank">Clique aqui para ver o local</a>'
}]
0
The JSON format/syntax defines that keys and values have to be quote strings and not plicas. So you need to escape the quotes that are in the middle of the string like this:
"<a href=\"http://bit.ly/1r1QIF4\" target=\"_blank\">Clique aqui para ver o local</a>"
outworking: http://myjson.com/51bzy
You can also swap the quotes inside the string by quotes. In this case it looks like this:
"<a href='http://bit.ly/1r1QIF4' target='_blank'>Clique aqui para ver o local</a>"
and the site also works: https://api.myjson.com/bins/2w67y
A tool that I use a lot and that indicates errors in JSON is the http://jsonlint.com/, by the creator of the JSON format himself.
Browser other questions tagged javascript json
You are not signed in. Login or sign up in order to post.
thanks, but when using
"<a href='http://bit.ly/1r1QIF4' target='_blank'>Clique aqui para ver o local</a>"
turned out to be" \u003ca href=\"http://bit.ly/1r1QIF4\" target=\"_blank\" \u003e Clique aqui para ver o local \u003c/a\u003e"
and then I couldn’t use it. what I do?– Natanael Junior
@Natanaeljunior ah, I see. Then use the first example or use
decodeURI(essaString);
– Sergio
thank you I got.....
– Natanael Junior