JsonElement. There are 4 types JSON elements. In this article I am going to explain how to read JSON with JAVA using Google-json library . The basic part of the JSON isThere are 4 types JSON elements. Json Object : Surrounded with curly braces and have child JSON elements Json Primitive Element : It contains field name and it's value Json Array Element : It contains field name and array of JSON elements. Json Null Element : It contains nothing Program Flow Program flow for JSON reading is shown in the below diagram. If element is JSON Object then iterate it into field names and JSON elements and process those JSON elements. If element is JSON Array then iterate it into JSON elements and process those JSON elements. If element is JSON Primitive then print its value as String









Java Code :

In the below example there are 3 JSON input strings, One is normal JSON String, Second-one is JSON Array, Third-one is Null.