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

  • Home
  • SEARCH
  • 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 6018067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:13:13+00:00 2026-05-23T03:13:13+00:00

Consider I have a JSON string of the following format: How do I parse

  • 0

Consider I have a JSON string of the following format:

How do I parse this using Gson so that I can write a method to perform actions based on individual occurrences of the values and their parents?

Here’s a sample JSON string, however, consider the actual JSON string to be much more complex one consisting of deeply nested subarrays.

A sample one:

    [{"Name":"First","Parent":"none","Elements":[{"One": 1, "Two": 2,"Parent":"none"}]},       
  {"Name":"Second","Parent":"First","Elements":"none"},
{"Name":"Third","Parent":"Second","Elements":"none"},
{"Name":"Fourth","Parent":"Eighth","Elements":[{"One": 1, "Two": 2,"Parent":"Tenth"}]},
{"Name":"Fifth","Parent":"none","Elements":[{"One": 1, "Two": 2,"Parent":"First"}]},
{"Name":"Sixth","Parent":"Fourth","Elements":[{"One": 1, "Two": 2,"Parent":"First"}]}, 
{"Name":"Seventh","Parent":"Sixth","Elements":[{"One": 1, "Two": 2,"Parent":"Ninth"}]},
{"Name":"Eighth","Parent":"Seventh","Elements":[{"One": 1, "Two": 2,"Parent":"Tenth"}]},
{"Name":"Ninth","Parent":"Fourth","Elements":[{"One": 1, "Two": 2,"Parent":"Eighth"}]},
{"Name":"Tenth","Parent":"Third","Elements":[{"One": 1, "Two": 2,"Parent":"Second"}]},
{"Name":"Eleventh","Parent":"First","Elements":[{"One": 1, "Two": 2,"Parent":"First"}]}]
  • 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-23T03:13:14+00:00Added an answer on May 23, 2026 at 3:13 am

    Perhaps not the answer sought:

    Gson does not currently have a built in mechanism to handle bi-directional references, during serialization or deserialization (except that for serialization fields in children referencing parents can be selectively excluded*, with the resulting JSON then lacking the parent reference data in the child, or custom serialization processing can replace the parent reference with a new JSON element, and for deserialization, it’s possible to implement custom processing along the lines M.J. described).

    Jackson does.

    *The mechanism to exclude a field from serialization is to actually specify that all of the other fields should be included. See the @Expose documentation for details.

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

Sidebar

Related Questions

Lets consider that I have a public property called AvatarSize like the following, public
Consider the following HTML. If I have a JSON reference to the <button> element,
Consider this as my json string, {Table : [{userid : 11,name : KumarP,designation :
Consider I have the following text in a UILabel (a long line of dynamic
Consider that I have a transaction: BEGIN TRANSACTION DECLARE MONEY @amount SELECT Amount AS
Consider this problem: I have a program which should fetch (let's say) 100 records
Consider this example (typical in OOP books): I have an Animal class, where each
This is a question for a WSS/SharePoint guru. Consider this scenario: I have an
I have a GeoDjango model object that I want't to serialize to json. I
I have a need for generating JavaScript on the server. I can do this

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.