I am using Gson for converting my Java Objects to GSON. I wanted to convert my HashMap to JSON.
Assuming my Object1 has structure:
public class Object1 {
     String a;
     String b;
     String c;
     String toString() {
          return "a: " + a + " b: " + b + " c: " + c;
     }
}
and my Object2 has Structure:
public class Object2 {
    String e;
    String f;
}
I wanted my final JSON to look like
{
    {
      "a" : "aValue",
      "b" : "bValue",
      "c" : "cValue"
    } : {
           "e" : "eValue",
           "f" : "fValue"
         } 
}
Bit I am getting it as
{
 "a: aValue b: bValue c: cValue" : {
        "e" : "eValue",
        "f" : "fValue"
  }
}
Is this possible to have it in desired form.
I tried using TypeToken given in JSON documentation. That didn't help.
 
     
     
     
    