27 March 2012

how to get data from sub node in jackon library for json ?

Jackson is an AWESOME multi-purpose Java library for processing JSON data format.

STORY:
It easy to take this example:

let's say that we have a following json:
{"ground":
[{
"overground":"birds",
"underground":"worms",
}],
"house":"cottage}

to get your house, you need:

pictureNode.path("house").asText();

PROBLEM:
how to get overground that is inside ground ?

SOLUTION:
 pictureNode.path("ground").path("underground").asText();

No comments:

Post a Comment