Vishal
Vishal

Reputation: 55

How to convert a Map of Map to Json

I have a Map syntax like Map<String,Map<String,String>> the data can be any dummy details i need the json created as below which has map of map data.

“<row id 1>”:{
 “record_id”:”<unique record id>”,
              “field”:[
                       {
                        “<1234>”  :”<value in field 1>”,
                        “<field 2>”  :”<value in field 2>” ,
                        “<field 3>”  :”<value in field 3>” ,
                        “<field n>”  :”<value in field n>”                      
                       }
                        ], 
                   },

      “<row id 2>”:{
            “record_id”:”<unique record id>”,
“field”:[
                       {
                        “<field 1>”  :”<value in field 1>”,
                        “<field 2>”  :”<value in field 2>” ,
                        “<field 3>”  :”<value in field 3>” ,
                        “<field n>”  :”<value in field n>”                      
                       }
                        ], 

                   },

How can use a jSONoBJECT here ?

Upvotes: 1

Views: 891

Answers (1)

Jon Lin
Jon Lin

Reputation: 143936

Are you trying to do something like this? http://www.androidsnippets.com/transform-a-map-to-a-json-object

Upvotes: 2

Related Questions