Vyhľadajte odpoveď

Vyhnite sa podvodom s podporou. Nikdy vás nebudeme žiadať, aby ste zavolali alebo poslali SMS na telefónne číslo alebo zdieľali osobné informácie. Nahláste prosím podozrivú aktivitu použitím voľby “Nahlásiť zneužitie”.

Ďalšie informácie

Filter out start of JSON responses

  • 1 odpoveď
  • 1 má tento problém
  • 4 zobrazenia
  • Posledná odpoveď od cor-el

more options

I sometimes use firefox to view data from APIs, however many private APIs include strings, usually `while(1);`, at the start of the JSON response for security reasons.

See this link as to why

Is there a way to get firefox to filter out these strings, so it can parse the json?

I sometimes use firefox to view data from APIs, however many private APIs include strings, usually `while(1);`, at the start of the JSON response for security reasons. [https://stackoverflow.com/questions/2669690/why-does-google-prepend-while1-to-their-json-responses See this link as to why] Is there a way to get firefox to filter out these strings, so it can parse the json?
Priložené obrázky

Všetky odpovede (1)

more options

You can possibly use a JavaScript bookmarklet to clean up the code if you have loaded the JSON response in a tab. Valid JSON usually starts with a '{' or a '[' and you can strip off leading characters. You may have to refine the code if it isn't working in special cases as I do not have examples to test it.

javascript:(function(){var t=document.querySelector('body>pre');t.textContent=t.textContent.replace(/^([^\[{])*(.*)/,'$2');})()