Java getting Json in parts

Typically, is there a way to get a large JSON string in a single request in parts?

For example, if I have a JSON string consisting of three large objects and each 1mb in size, can I somehow get the first 1mb in one request, then analyze it, and 3 more objects will be loaded, and not wait for the full 3mb version to download?

+6
source share
1 answer

If you know how big the parts are, you could split your request into three using HTTP range requests. Assuming your ranges are defined correctly, you should be able to receive JSON objects directly from the server (if the server supports range requests).

Please note that this depends on: a) the server’s ability to handle range requests, b) the idempotency of your REST operation (it can launch a call three times very well, the cache can help with this) and c) your ability to know ranges before you call.

0
source

Source: https://habr.com/ru/post/973592/


All Articles