tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 JSON > FLEX JSON > How to Deserialize JSON String to Map

How to Deserialize JSON String to Map 

Flexjson is a lightweight java library for serializing and de-serializing java beans, maps, arrays and collections in JSON format. Get the latest binaries from This requires the library flexjson-2.1.jar to be in classpath. The following example shows how to Deserialize the given JSON String to a Map.

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.flexjson.tests;

import java.util.Map;

import flexjson.JSONDeserializer;

public class Deserialize2MapTest {

   @param args
  public static void main(String[] args) {

    JSONDeserializer<Map> deserializer = new JSONDeserializer<Map>();
    String jsonStr =
      "{" +
          "\"age\": 2," +
          "\"dob\": 1339935437234," +
          "\"firstName\": \"Sriram\"," +
          "\"hobby\": \"Singing\"," +
          "\"lastName\": \"Kasireddi\"" +
    Map stdMap = deserializer.deserialize(jsonStr);


It gives the following output,
{lastName=Kasireddi, age=2, dob=1339935437234, hobby=Singing, firstName=Sriram}



Books Recommendation

bl  br