Skip to content

Exploring basic features of google's GSON library.

Notifications You must be signed in to change notification settings

mtumilowicz/gson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

gson

Exploring basic features of google's GSON library.

Reference: https://github.com/google/gson

project description

We serialize / deserialize objects from / to json using GSON.

manual

  • gson
    • to json
      def customerJson = new Gson().toJson(customer)
      
    • from json
      JsonReader reader = new JsonReader(new FileReader("src/test/resources/customerFull.json"))
      def customer = new Gson().fromJson(reader, Customer.class)
      
    • with serializing nulls
      Gson gson = new GsonBuilder().serializeNulls().create()
      def customerJson = gson.toJson(customer)        
      
    • pretty (well formatted) json
      Gson gson = new GsonBuilder().setPrettyPrinting().create()
      println gson.toJson(customer)  
      

About

Exploring basic features of google's GSON library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published