Hy guys I have this HashMap:
HashMap<User, HashMap<ArrayList<User>, Yield>> userYield = new HashMap<>();
User and Yelda are objects and, after I fill the HashMap, I've to put the HashMap in a JSON, how I could be?
Edit:
with JSONObject this is the result :
{
" id:4575, nome:Bill, cognome:Man": {
"[ id:3743, nome:John, cognome:Redo, id:3243, nome:Gian, cognome:Vand, id:34243, nome:Mike, cognome:Mill]": {
"incassoAzienda": 80,
"incasso": 125,
"idRendimento": 1,
"incassoAgenzia": 45
}
}
} What I want is something like this, if it is possible:
{
" id:4575, nome:Bill, cognome:Man": {
"{ id:3743, nome:"John", cognome:"Redo", id:"3243", nome:"Gian", cognome:"Vand", id:"34243", nome:"Mike", cognome:"Mill"}": {
"incassoAzienda": 80,
"incasso": 125,
"idRendimento": 1,
"incassoAgenzia": 45
}
}
}
HashMap<User, HashMap<ArrayList<User>, Yield>>would mean json like{ "gianluca23" : { ["gianluca23"] : {"someYield"}}}, i.e. you'd want to use a list as the key. I might be missing something but I'm pretty sure that's not valid json. So what should the resulting json look like or at least what do you want it to express (and what would the nested maps express)? (And what did you try so far?)new Gson().toJsonbut the JSON is not valid