Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7080471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:47:58+00:00 2026-05-28T06:47:58+00:00

I am making a query call to freebase and I receive a JSON response.

  • 0

I am making a query call to freebase and I receive a JSON response. The response has the following structure:

{
  "code":          "/api/status/ok",
  "result": [
    {
      "/common/topic/image": [{
        "guid": "#9202a8c04000641f8000000004b67f6d"
      }],
      "/people/person/profession": [{
        "name": "Critic"
      }],
      "id":   "/en/michael_jackson_1942",
      "name": "Michael Jackson",
      "type": "/people/person"
    },  
    {
      "/common/topic/image": [{
        "guid": "#9202a8c04000641f800000001b90fdea"
      }],
      "/people/person/profession": [{
        "name": "Actor"
      }],
      "id":   "/en/michael_jackson_1970",
      "name": "Michael Jackson",
      "type": "/people/person"
    }
  ],
  "status":        "200 OK",
  "transaction_id": "cache;cache03.p01.sjc1:8101;2012-01-16T18:28:36Z;0055"
}

I need to parse this response in a ArrayList of java objects using GSON. To do this I need to create the class of the object with get/set and make it available to parse. Or is there another simpler way to do things ? I have used simple JSON strings by now, but in this case I can’t remake the structure of the class I need. Basically in the end I need something like ArrayList<Person> where Person has all the attributes from the json string.

Any help is appreciated. Thank you.

The final solution, according with the answer below

public class FreebaseResponse {
    @SerializedName("code")
    public String code;

    @SerializedName("result")
    public ArrayList<Person> result;

    @SerializedName("status")
    public String status;

    @SerializedName("transaction_id")
    public String transaction_id;
}

public class Person {
    @SerializedName("/common/topic/image")
    public ArrayList<Person.Guid> imageGuid;

    @SerializedName("/people/person/profession")
    public  ArrayList<Person.Profession> profession;

    @SerializedName("id")
    public String id;

    @SerializedName("name")
    public String name;

    @SerializedName("type")
    public String type;

    private class Guid
    {
        @SerializedName("guid")
        public String guid;
    }

    private class Profession
    {
        @SerializedName("name")
        public String name;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:47:59+00:00Added an answer on May 28, 2026 at 6:47 am

    I guess you can create a FreebaseResponse class that contains code, result (ArrayList<Person>), etc fields and use Gson to deserialize. the names that are not valid identifiers, e.g. /common/topic/image will be a problem. I haven’t tried it myself but it seems to me that SerializedName annotation should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function call in a query, and that result has to be
I am making a database call through the following parametrized query. set recordset =
I am making an ajax call that returns some json data. I need to
I'm making FQL calls using the following url and then making a curl call.
In VB6 I'm making a call to the Windows API DnsQuery . Private Declare
I'd like to query the current threadID without making a windowsAPI call. According to
I'm developing a simple function that, making use of superagent module, query an API
I'm making a query to a MongoDB and I only want the first object.
I am trying and so far not succeeding in making a query with a
I am making a search query on local Apache Solr Server by browser and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.