Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between gson and json? [closed]

I see word 'gson' at various places in books related to android , blogs etc. Is it similar to kml in any way or it is different .

like image 930
Rishabh Maurya Avatar asked Nov 02 '16 18:11

Rishabh Maurya


3 Answers

JSON is a data format that is human-readable and supported by a wide variety of languages. An example of JSON encoded data:

{
  "name":"John",
  "age":27,
  "interests":["running", "guitar", "foreign movies"],
  "favorites":{
               "color":"blue",
               "book":"Gödel, Escher, Bach: An Eternal Golden Braid"
              }
}

GSON is a java API from Google that converts java objects to their JSON representations and vice-versa. Installation instructions and sample usage here.

like image 169
bslawski Avatar answered Oct 09 '22 06:10

bslawski


Google Gson is a simple Java-based library to serialize Java objects to JSON and vice versa. It is an open-source library developed by Google.

The following points highlight why you should be using this library −

Standardized − Gson is a standardized library that is managed by Google.

Efficient − It is a reliable, fast, and efficient extension to the Java standard library. Optimized − The library is highly optimized.

Support Generics − It provides extensive support for generics.

Supports complex inner classes − It supports complex objects with deep inheritance hierarchies.

like image 33
amith singh Avatar answered Oct 09 '22 07:10

amith singh


Gson is Java API,used to convert between Java objects and JSON objects.

like image 37
Vinayak Avatar answered Oct 09 '22 07:10

Vinayak