wordSmith
wordSmith

Reputation: 3183

download json file instead of console.log-ging it in $.getJson()

Is there a way I can download a json file instead of getting with jQuery's $.getJSON() and logging the callback function's argument, which is the json?

I don't want to manually type it from the console.log because it is long. Is there a way I can print it perhaps, and not formatted, so I can copy - paste it into a .json file?

I can't just go to the URL as I'm passing some json to the url as $.getJSON()'s second argument to access the response json.

Upvotes: 0

Views: 160

Answers (1)

Shooky
Shooky

Reputation: 1299

try using

JSON.stringify(response);

There are also many websites and plugins that will let you make POST requests from your browser such as hurl.it or Postman (Chrome app).

Upvotes: 3

Related Questions