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

The Archive Base Latest Questions

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

So I am trying to pull data from my database and essentially create a

  • 0

So I am trying to pull data from my database and essentially create a JSON file that looks like this. I know of that I can use my_json_object.put(); but that seems to only work for String, String. I and I want to create the value with 2 entries, and the second entryw ill actually be an array of many values. How can I achieve that? Thanks guys.

{"value": {
"name": "History",
"values": [ 
{"front": "History Market", "back": " It is the world of the world that the world    could not say that", "color": "Yellow"},
{"front": "History Market", "back": " It is the world of the world that the world could not say that", "color": "Red"},
{"front": "History Market", "back": " It is the world of the world that the world could not say that", "color": "Purple"},
{"front": "History Market", "back": " It is the world of the world that the world could not say that", "color": "Blue"},
{"front": "History Market", "back": " It is the world of the world that the world could not say that", "color": "Blue"}
]}}
  • 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:10:43+00:00Added an answer on June 18, 2026 at 9:10 am

    Create your current jsonObject as :

    //Create main json object
    JSONObject json = new JSONObject();
    
    //Create value json object
    JSONObject valueJson = new JSONObject();
    
    //Create values JSONArray
    JSONArray valuesarray = new JSONArray();
    
    for(int i=0;i<=4;i++){
     // Create values jsonObject
    JSONObject valuesJson = new JSONObject();
    valuesJson.put("front","front_value");
    valuesJson.put("back","back_value");
    valuesJson.put("color","color_value");
     // put values jsonObject to valuesarray JSONArray
    valuesarray.put(valuesJson);    
    
    }
     // put name key-value to value jsonObject
    valueJson.put("name","History");
     // put values JSONArray to value jsonObject
    valueJson.put("values",valuesarray);
    
     // put value jsonObject to final json Object
    json.put("value",valueJson);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive got a database that Im trying to pull data from (the name of
I can't seem to pull ordered data from the database. I'm trying to list
I'm trying to pull data from my database using json in php. I have
I'm trying to pull in data from a remote SQL Server. I can access
I am using jQuery and JSON to pull data from a database. Each row
I'm trying to pull some html data from a mysql database to populate a
I'm trying to pull some binary data from a database and write them to
I am trying to pull data from a Database using C#.net and use a
I'm trying to pull data from the last row inserted (_id) of a database.
I'm trying to create an app for the iPhone where I pull data from

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.