简体   繁体   中英

how to parse Freebase topic api response with gson

is it possible to parse the json response returned by the Freebase experimental TOPIC Api with the google gson library? i have used gson to parse the json repsone from multiple freebase mqlread responses. i am now stuck attempting to parse json messages like the response from this

http://api.freebase.com/api/experimental/topic/basic?id=/en/sgt_peppers_lonely_hearts_club_band

or from this

http://api.freebase.com/api/experimental/topic/basic?id=/en/please_please_me,/en/sgt_peppers_lonely_hearts_club_band

or this

http://api.freebase.com/api/experimental/topic/standard?id=/guid/9202a8c04000641f800000000de75560&domains=all

is it possible to parse all three repsones with one gson "code set"

I have not tried to do this but there is no reason why it wouldn't work. Are you getting any errors when you use it ? If you paste your code and errors I might be able to help you more.

Take a look at the answer to this question:

Stuck on parsing a JSON response to a Java Object in Android

The same approach should work for the Topic API.

I gave up on GSON and switched to JACKSON it works perfectly for extracting the data of interest and ignoring everything else. thanks for all the time spent in responding to my question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM