Doubts on myjson

1

I would like to use this code on myjson.com but give me the error Error: Your JSON appears to be invalid. . How should I do it?

[{        
    "imagem": '<a href="http://bit.ly/1r1QIF4" target="_blank">Clique aqui para ver o local</a>'
}]
    
asked by anonymous 01.06.2016 / 20:45

1 answer

0

The JSON format / syntax defines that keys and values must be strings with quotation marks, not quotes. 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>"

result : link

You can also change the quotation marks within the string by strings. 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: link

A tool that I use a lot and that indicates errors in JSON is the link , made by the JSON formatter itself.

    
01.06.2016 / 20:47