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 9248093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:53:05+00:00 2026-06-18T09:53:05+00:00

I’ve a json output which returns something like this : [ { title:facebook, description:social

  • 0

I’ve a json output which returns something like this :

[
 {
  "title":"facebook",
  "description":"social networking website",
  "url":"http://www.facebook.com"
 },
 {
  "title":"WoW",
  "description":"game",
  "url":"http://us.battle.net/wow/"
 },
 {
  "title":"google",
  "description":"search engine",
  "url":"http://www.google.com"
 }
]

I am familiar with parsing json having the title object, but i’ve no clue about how to parse the above json as it is missing the title object. Can you please provide me with some hints/examples so i can check them and work on parsing the above code?

Note : I’ve checked a similar example here but it doesn’t have a satisfactory solution.

  • 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-06-18T09:53:06+00:00Added an answer on June 18, 2026 at 9:53 am

    Your JSON is an array of objects.

    The whole idea around Gson (and other JSON serialization/deserialization) libraries is that you wind up with your own POJOs in the end.

    Here’s how to create a POJO that represents the object contained in the array and get a List of them from that JSON:

    public class App 
    {
        public static void main( String[] args ) 
        {
            String json = "[{\"title\":\"facebook\",\"description\":\"social networking website\"," +
                "\"url\":\"http://www.facebook.com\"},{\"title\":\"WoW\",\"description\":\"game\"," +
                "\"url\":\"http://us.battle.net/wow/\"},{\"title\":\"google\",\"description\":\"search engine\"," +
                "\"url\":\"http://www.google.com\"}]";
    
            // The next 3 lines are all that is required to parse your JSON 
            // into a List of your POJO
            Gson gson = new Gson();
            Type type = new TypeToken<List<WebsiteInfo>>(){}.getType();
            List<WebsiteInfo> list = gson.fromJson(json, type);
    
            // Show that you have the contents as expected.
            for (WebsiteInfo i : list)
            {
                System.out.println(i.title + " : " + i.description);
            }
        }
    }
    
    // Simple POJO just for demonstration. Normally
    // these would be private with getters/setters 
    class WebsiteInfo 
    {
        String title;
        String description;
        String url;
    }
    

    Output:

    facebook : social networking website
    WoW : game
    google : search engine

    Edit to add: Because the JSON is an array of things, the use of the TypeToken is required to get to a List because generics are involved. You could actually do the following without it:

    WebsiteInfo[] array = new Gson().fromJson(json, WebsiteInfo[].class); 
    

    You now have an array of your WebsiteInfo objects from one line of code. That being said, using a generic Collection or List as demonstrated is far more flexible and generally recommended.

    You can read more about this in the Gson users guide

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am using JSon response to parse title,date content and thumbnail images and place
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I am confused How to use looping for Json response Array in another Array.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is

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.