Object Class:
class User{
public String name;
public String password;
}
JSON:
{ sc:"200", msg:"something", userInfo:{name:"n", password:"p"} }
I want to get results like this:
Map->contains 3 key-value
"sc"="200"
"msg"="something"
"userInfo"=User(Object Class)
How can I do this? Or, how can I get it to use another JAR tools package?
You have to choose if you want “untyped” (Maps, Lists, wrappers), which are easy enough to get:
or POJOs. The thing is, mapper really can’t know that you want “userInfo” to map to a specific object, but other values to something else.
But I would rather just create another class, like:
and bind to that:
Why mess with inconvenient Maps when you can have real POJOs, right? 🙂