java - Json to HashMap -
i have following json output, how convert hashmap using gson:
{ "result": { "haystack": [ "svqfd", "ucr3y", "azvb0", "drdql", "gc8lq", "jqkdk", "9ze4g", "820gw", "ekwkr", "qgdrr", "enpyz", "lf4b8", "szsut", "yo0cq", "cd1o0", "rvw8t", "eusc0", "3oemt", "6bugc", "m8pfk" ], "needle": "lf4b8" } }
i tried:
type stringarraymap = new typetoken<map<string, string[]>>(){}.gettype(); map<string,string[]> thecollection = gson.fromjson(output, stringarraymap);
edit: each time json output,its content unique same structure.
answer
answers , suggestions below worked played around , figured else worked well;
type stringstringobjectmap = new typetoken<map<string, map<string, object>>>(){}.gettype(); map<string, map<string, object>> thedictionary = gson.fromjson(output, stringstringobjectmap);
Comments
Post a Comment