As a Web developer, I sometimes find a need to download some huge
JSON object into a text file.
Modern browsers now come with some form of developer tool/console to
help debug the monstrous amount of JavaScript in the Web page. For
Chrome and Firefox, I simply press F12 to bring up the console. From
the console, you can naturally copy the JSON object in its string
form by first converting the object into a string like so:
Then highlight the output from the developer console and press
Ctrl-C to copy. The trouble comes in when the object is huge - to
the tune of thousands of properties.
When an object gets to that size, you will need to scroll to be able
to select the complete output. Scrolling the console is itself a
tiresome task with text that small. Moreover you run the risk of
"over scrolling" such that you select two objects rather than
one because you can't tell the difference when they are simply
chunks of text.
The best solution is to download the JSON as a text file and then
use/manipulate the JSON from the file.
The way to do this is to create a function like this: