Reputation: 571
what is the Json representation of HashMap<String, String>
?
I have tried this way but getting bad request error.
"userPreferences":{{"mobile":"yes"},{"email":"yes"}}
Upvotes: 17
Views: 35206
Reputation: 571
It should be like this
{ "userPreferences":{"mobile":"yes","email":"yes"} }
Upvotes: 23
Reputation: 107566
The JSON you have would be invalid even as a JavaScript object, since you haven't defined property names for the two "inner" objects. A HashMap
is basically a set of key-value pairs. Your JSON should look like:
"userPreferences": {
"mobile": "yes",
"email": "yes"
}
Upvotes: 3