Posted In: GSON, JSON

How to use GSON streaming JsonReader to read big JSON file

Usecase – You have JSON data stored at a location. It is big so do not have luxury to read it fully in GSON or you just need use some part of JSON. GSON API provides streaming JsonReader class to do that. Maven Jackson 2X Classes used from GSON com.google.gson.stream.JsonReader Test data Output

Read More

Tags:

by , on August 8th, 2017

Posted In: GSON, JSON

Check two JSON Objects for equality – GSON

  This example uses GSON library     Examples using GSON   1. Success test with a JSON string   2. Error test with a JSON string   3. Success test with a JSON string This test covers How do I compare 2 json files having same key-values but in different order in java?  

Read More

Tags: , ,

by , on February 24th, 2017

Posted In: GSON, JSON

Generate Java POJO from JSON or JSON schema – Annotation style – GSON

  We created POJOs from JSON in previous example generate-java-pojo-from-json-or-json-schema. Let us go through some options that we have on http://www.jsonschema2pojo.org/   Annotation style – GSON 1. Example will use following sample JSON     2. Following POJO will be generated     3. Use Gson library to parse JSON and populate POJOs     […]

Read More

Tags: ,

by , on February 20th, 2017

  • Categories