With GSON, I can write this
JsonStreamParser parser = new JsonStreamParser(reader);
System.out.println(parser.next());
and if the stream consists of JSON objects, it will print the entire object out as a string.
Is there a simple way to do that with Jackson or do I need to use the while loop pattern that I see used in examples?
So if the first object was:
{
“id”: 1,
“name”: “Foo”,
“price”: 123,
“tags”: [ “Bar”, “Eek” ],
“stock”: {
“warehouse”: 300,
“retail”: 20
}
}
The first line printed would be :
{“id”: 1,”name”: “Foo”,”price”: 123,”tags”: [ “Bar”, “Eek” ],”stock”: {“warehouse”: 300,”retail”: 20}}
In streaming mode, every JSON “string” is consider as a single token, and each tokens will be processed incremental, that why we call it “incremental mode”. For example,
You can write the following code for parsing the above json text