tulios / json-viewer

It is a Chrome extension for printing JSON and JSONP.
https://chrome.google.com/webstore/detail/json-viewer/gbmdgpbipfallnflgajpaliibnhdgobh
MIT License
3.31k stars 679 forks source link

Not work on localhost #57

Closed mmikhan closed 9 years ago

mmikhan commented 9 years ago

Hi, It isn't wokring for me on my localhost development. I'm fetching a JSON result from a 3rd party site, however it's not highlighting the result. It works when it's not on localhost. I tried to enable it from the chrome -> extension options, however I've not find any relevant options on there which enable it for localhost. Is there anything I'm missing?

tulios commented 9 years ago

Hi @mazedulislamkhan, can you try to disable and re-enable the extension? Sometimes chrome mess up with the URL matches.

mmikhan commented 9 years ago

Hi, I disabled and re-enabled it, no luck yet. Not sure why it's not working on localhost :/

tulios commented 9 years ago

:/ have you tried another project in localhost? And can you provide an example of the response? Maybe something in the response is crashing the plugin, have you noticed any error in the console?

mmikhan commented 9 years ago

Hi, I've now tested with: https://api.github.com/repos/tulios/json-viewer this and it also didn't work. I've ran the result on the Chrome console and there's no error. On chrome console the JSON object is appearing correctly as expected.

Here's a sample result which I hope you find helpful:

{"sid":"SM3942f5f4e06d484ba6c6c567459fa107","date_created":"Thu, 27 Aug 2015 17:41:40 +0000","date_updated":"Thu, 27 Aug 2015 17:41:41 +0000","date_sent":"Thu, 27 Aug 2015 17:41:40 +0000","account_sid":"AC289516feb708fad78a83eec5d82b329d","to":"+16469267421","from":"+18554725915","body":"Thanks for the message. Configure your number's SMS URL to change this message.Reply HELP for help.Reply STOP to unsubscribe.Msg&Data rates may apply.","status":"delivered","num_segments":"1","num_media":"0","direction":"outbound-reply","api_version":"2010-04-01","price":"-0.00750","price_unit":"USD","error_code":null,"error_message":null,"uri":"\/2010-04-01\/Accounts\/AC289516feb708fad78a83eec5d82b329d\/Messages\/SM3942f5f4e06d484ba6c6c567459fa107","subresource_uris":{"media":"\/2010-04-01\/Accounts\/AC289516feb708fad78a83eec5d82b329d\/Messages\/SM3942f5f4e06d484ba6c6c567459fa107\/Media.json"}}
tulios commented 9 years ago

Thanks for the report. One last question, do you have any other json highlighter installed? And if it is the case, can you disable then and try again? Anyway I will test your data, thanks again!

mmikhan commented 9 years ago

Hi, I was using a different syntax highlighter. However, it was one of them which I don't like at all. So I removed it today and then I installed yours.

If you find anything helpful for me then please do let me know :)

tulios commented 9 years ago

hey @mazedulislamkhan, I did some tests with your sample data and everything worked as expected. Can you try to reinstall the plugin? (uninstall/install)

localhost examples:

working-example
mmikhan commented 9 years ago

Hi, Not sure why it's not working on my end then :(

screen shot 2015-09-03 at 2 40 44 am
tulios commented 9 years ago

@mazedulislamkhan can you check the option maxJsonSize in the Add-Ons section, can you try to increase the value? I think that your json is bigger than the default max size.

mmikhan commented 9 years ago

Already tried that my friend :) no luck.

tulios commented 9 years ago

I really want to help you with this problem :)

I'm suspecting that other plugin is changing the basic layout of chrome pages. Json-viewer will only activate in blank templates. Can you try in incognito mode with only json-viewer? And can you provide the page markup? (view page source of the json result page).

The basic layout only contains a body and a pre with the content. You can check the code here: https://github.com/tulios/json-viewer/blob/master/extension/src/json-viewer/check-if-json.js

mmikhan commented 9 years ago

Hi, Apologies for the excessive delay in responding. I've now tested it again using different environment with Laravel and it worked as expected. So previously there must be something that's preventing this. So the issue is now resolved then.

tulios commented 9 years ago

Ok, thanks for reporting.