serialization - Deserializing flattened JSON to Java Object using Jackson -


so using jackson deserialize json complex java objects. works have fields such as:

{   "foo.bar.baz":"qux" } 

which correspond java objects such as:

class foo {     anotherclass bar; }  class anotherclass {     string baz; } 

jackson unable figure out dots correspond inner objects. there way jackson able deserialize on flattened fields such field in example?

no jackson json library not detect different object levels. can use instead:

{   "foo": {        "bar": {             "baz":"qux"         }   } } 

and have create:

  • class wrapperclass containing "foo" of type fooclass
  • class fooclass containing "bar" of type barclass
  • class barclass containing "baz" of type string

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -