• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSON parse with Objectmapper JAVA  RSS feed

 
Jim Halpert
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the JSON string:



This is the code:


With the following mapper:




It gives me no error, just an empty arraylist of results...



Library: Jackson
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which JSON library are you using (there are several) - Jackson?
 
Jim Halpert
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:Which JSON library are you using (there are several) - Jackson?

Yes sir
 
Ben Ooms
Ranch Hand
Posts: 47
Debian Eclipse IDE Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know why youre using those static classes but based on the json example a parsable java representation whould be

With this code and json sample provided you should be able to test with:



Don't forget that Jackson is using the public getters and setters to serialize/deserialize by default (can be overiden)
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSON string isn't a representation of a "d" object, but of an object that contains one property named "d" that has the same structure as a "d" object would have. So you will either need to remove those outer curly braces (and the "d" property name, but not the value), or create a class that contains one single "d" property called "d".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!