Log in



Tags » ‘JSON’

Serialization 101 with JSON in Android

June 17th, 2012 by

JSON is a wonderful data format. It is lightweight, easy to use, and has a simple structure that closely matches data types and structures available in any full-featured programming language (implementations exist for several dozen programming languages). When i am not using libs11n for serialization, i use JSON.

This post is about getting started with JSON-based serialization in Java. What does “serialization” mean? It basically means “saving and loading,” but at a more abstract level than simply to/from files. Serialization has many uses, e.g. passing data between activities or services (e.g. GDrive or the clipboard). Why not use Java’s built-in serialization? It is fine for RPC and other forms of transient data, but its format is not guaranteed to stay stable across invocations, and is therefore completely unsuited for use in storing application data longer-term.