In the latest versions of Firefox, it has this nifty JSON Viewer built in. Works great, looks awesome, love it.

I have some web servers I deal with that send back JSON that is not strictly proper, in that the property names are not enclosed in quotes; so this:

myproperty: "some value" 

instead of this:

"myproperty": "some value"

In this case, Firefox doesn't seem to recognize the data as JSON and won't show it in the JSON viewer. Anyone know of maybe some hidden about:config settings or something or some other way, to enable the JSON viewer for 'JSON' that isn't strictly formatted like this?


I reasonably doubt that such tweak would exist in the Firefox or any other software, 'cause it would be a direct violation of the JSON standard, which could've resulted in the undefined parsing behaviors

one thing you could do is to pre-process your inputs before loading into Firefox. For example, if the only deviations in your inputs is that the labels are not quoted (and the label does not contains white spaces), then pre-processing it with sed would look like this:

bash $ cat file.json 
{ myproperty: "some value" }
bash $ 
bash $ cat file.json | sed -E 's/([^ ]+): /"\1": /g'
{ "myproperty": "some value" }
bash $ 

Though that solution is also prone to false-positives - it relies on the assumption that column sign : would not occur adjacent to any other words but the labels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.