Bolto Cavolta
Bolto Cavolta

Reputation: 443

Save large JSON to text straight from REST API response stream in Java

What is the best way to save a large JSON from a REST API call to a text file? I currently use Postman in Chrome to test the API and sometimes it makes Chrome un-responsive due large JSON output. I would like to write some Java codes to save the large JSON to a text file. Is there a way to stream the REST output straight to text input stream so that it wouldn't take too much memory at run time?

Upvotes: 0

Views: 2856

Answers (1)

cmonkey
cmonkey

Reputation: 4296

Suggest that you use cURL.

An example usage is found here : Capture Curl Output to a File

It should be more efficient than buffering the entire output.

Upvotes: 1

Related Questions