1
我對藝術家約瑟夫·特納以下元數據:如何使用@JsonProperty檢索兒童房產?
{
"activePlaceCount":0,
"birth":{
"place":{
"name":"London, United Kingdom",
"placeName":"London",
"placeType":"inhabited_place"
},
"time":{
"startYear":1775
}
},
"birthYear":1775,
"date":"1775\u20131851",
"death":{
"place":{
"name":"Chelsea, United Kingdom",
"placeName":"Chelsea",
"placeType":"neighbourhood"
},
"time":{
"startYear":1851
}
},
"fc":"Joseph Mallord William Turner",
"gender":"Male",
"id":558,
"mda":"Turner, Joseph Mallord William",
"movements":[
{
"era":{
"id":290,
"name":"18th century"
},
"id":345,
"name":"Picturesque"
},
{
"era":{
"id":350,
"name":"19th century"
},
"id":364,
"name":"Romanticism"
},
{
"era":{
"id":290,
"name":"18th century"
},
"id":349,
"name":"Sublime"
}
],
"startLetter":"T",
"totalWorks":41861,
"url":"http://www.tate.org.uk/art/artists/joseph-mallord-william-turner-558"
}
如果我想在我的Java程序映射fc
到firstName
,我可以簡單地做到以下幾點:
@JsonProperty("fc")
private String fullName;
也就是說,或private String fc
。
如果想要檢索"death"."time"."startYear"
,我該怎麼辦?
不能(很容易)用jackson objectmapper,但你可以使用不同的庫,特別是如果你只是在閱讀json感興趣:https://github.com/jayway/JsonPath – zapl