Friday, February 21, 2014

Gson (on Android Studio)

Why I met with Gson?

While I was try to store one whole complex object into SharedPerference in Android code, I found that it's default basic data types are not supporting. Also, it's hard to decode them in to json string unless I am writing it's custom encoding function.

Then, I found people are solving this problem using Gson on StackOverflow.

Intro for Gson

"Gson is a Java library that can be used to convert Java Objects into their JSON representation."

Install Gson on Android Studio

Follow the top answer in this StackOverflow thread.

Usage