Streaming JSON String Values #1409
Replies: 2 comments 22 replies
-
Have you looked at other JSON libraries? I'm not against Jackson supporting something like this but it is likely to be a lot of work - especially since the pressure will come on to have jackson-databind and other related libs also support this. https://github.com/jettison-json/jettison is worth looking at since it is basically JSON support but using the StAX API. A large json value could be represented as many CharacterEvents. You can override the StreamReadConstraints if you are just hitting issues with the 20m char default limit for String values. Just to be contrary, I just don't think JSON was designed for placing gigabytes of data in string values. There are so many better ways to represent this kind of data. |
Beta Was this translation helpful? Give feedback.
-
@pjfanning I assume you do not have context on Jettison, but as I recall, it's more of a joke than serious thing to use. Exposing JSON via XML API is a bad idea to begin with (due to structural impedance), and implementation of JSON handling is not any better. I know Dan D and he considered the library to be one his less good ideas. :) So while it might ostensibly look like a useful thing, it is not. Starting with a joke ("badgerFish convention") mixing up API and content... nope. |
Beta Was this translation helpful? Give feedback.
-
Idea: Provide means to stream huge values (e.g JSON Strings containing a base64 encoding of some large binary file) when using a NonBlockingJsonParser, rather than requiring string values to fit into memory. It would be great if I would could specify a max value-textbuffer size. When a given value exceeds that size, the parser would make the value accessible in some streaming fashion, rather than trying to fully load it into memory.
Use Case: I'm implementing a proxy-like application that provides some filter mechanism on JSON payload. For this I need to parse the proxied responses, in order to detect the keys to filter, but I'm usually not interested in reading the values other than passing them along. In order to enable proxying arbitrary json-payloads (incl. those with huge string values) while keeping the memory-footprint under control, I'd love to have the above streaming access to individual CLOB values.
Beta Was this translation helpful? Give feedback.
All reactions