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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:31:39+00:00 2026-06-12T07:31:39+00:00

I have a JSON string like this of data for a table in an

  • 0

I have a JSON string like this of data for a table in an android app. one of {} is a row of data for the table. I want to separate these {}s into an array and then each element inside this array into other sub-arrays separating other elements inside {}. Please suggest an appropriate way of accomplishing this criteria using JSON. Thank you.

[
     {
        "nodeName":"prime_mtsc22@smpp3",
        "nodeId":"MTSC3",
        "tidPrefix":"4",
        "optStatus":"offline",
        "daStart":"1",
        "daEnd":"3",
        "description":"Description"
     },
     {
        "nodeName":"prime_mtsc22@smpp2",
        "nodeId":"MTSC58",
        "tidPrefix":"1",
        "optStatus":"blocked",
        "daStart":"5",
        "daEnd":"10",
        "description":"new description"
     },
     {
        "nodeName":"prime_mtsc22@smpp1",
        "nodeId":"MTSC1",
        "tidPrefix":"15",
        "optStatus":"online",
        "daStart":"12",
        "daEnd":"20",
        "description":"Description"
     },
     {
        "nodeName":"prime_mtsc22@smpp0",
        "nodeId":"MTSC15",
        "tidPrefix":"15",
        "optStatus":"offline",
        "daStart":"25",
        "daEnd":"30",
        "description":"Description"
     }
]
  • 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-12T07:31:40+00:00Added an answer on June 12, 2026 at 7:31 am

    ok so in that case the code to use is this

    String jsonString = <your jsonString>;
    
    // THIS IS NOT NEEDED ANYMORE 
    //JSONObject json = new JSONObject(jsonString);
    
    JSONArray topArray = null; 
    try {
         // Getting your top array
    
         // THIS IS NOT NEEDED ANYMORE 
         //topArray = json.getJSONArray(jsonString);
    
         //use this instead
         topArray = new JSONArray(jsonString);
    
          // looping through All elements
          for(int i = 0; i < topArray.length(); i++){
          JSONObject c = topArray.getJSONObject(i);
    
          //list holding row data
          List<NodePOJO> nodeList = new ArrayList<NodePOJO>(); 
    
          // Storing each json item in variable
          String nodeName = c.getString("nodeName");
          String nodeID = c.getString("nodeID");
    
          NodePOJO pojo = new NodePOJO();
          pojo.setNodeName(nodeName);
          //add rest of the json data to NodePOJO class
    
          //the object to list
          nodeList.add(pojo);
    
        }
    } catch (JSONException e) {
            e.printStackTrace();
     }
    

    ok?

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

Sidebar

Related Questions

I am getting JSON string from website. I have data which looks like this
I have this json string: $row['medium'] = {\medium\:13|17|1|14, \medium_sub\:21}; now I want to make
I have a json string like this: { d: { results: [ { __metadata:
I have a JSON string that looks like this: { package1: { type: envelope,
I have one column in my table which will store data in string format
I have this json string {Table : [{subject : No Records are there to
I have web service which return json string like : d={main0ID:abc.es/main,main1ID:ah/main} I wanna append
I have a JSON string that I would like to include as a value
I have a get/post/JSON function on an aspx page. This page adds data entered
I have a WCF REST Service which accepts a JSON string One of the

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.