Hector
Hector

Reputation: 5356

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"

Upvotes: 1

Views: 345

Answers (3)

Shawn Simister
Shawn Simister

Reputation: 4603

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.

Upvotes: 1

Hector
Hector

Reputation: 5356

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

Upvotes: 0

Michael Masouras
Michael Masouras

Reputation: 511

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.

Upvotes: 1

Related Questions