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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:54:43+00:00 2026-05-22T12:54:43+00:00

I want to get data from my Sqlite database and put it into this

  • 0

I want to get data from my Sqlite database and put it into this JSON file.

How can I create a json file and insert the data obtained from my database into the JSON file?

I want data in JSON file in this format:

{

"data": [
    {
        "data": [
            null,
            null,
            30,
            45,
            69,
            70,
            65
        ],
        "title": "title5" 
    },
    {
        "data": [
            null,
            5,
            10,
            15,
            22,
            30 
        ],
        "title": "title4" 
    },
    {
        "data": [
            40,
            55,
        ],
        "title": "title3" 
    },
    {
          "data": [
              null,
            89,
            90,
            85
        ],
        "title": "title2" 
    },
    {
        "data": [
            66,
            77,
            55,
            33,
            50,
            -6,
            -8
        ],
        "title": "title1" 
    } 
],
 "x_labels": [
    6,
    7,
    8,
    9,
    10,
    11,
    12
]
}

How can I do this?

  • 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-22T12:54:44+00:00Added an answer on May 22, 2026 at 12:54 pm

    Create Obj C object reading data from your sqlite database. Say

    @interface Data:NSObject {
      NSArray *data;
      NSString *title;
    }
    
    NSArray *dataArray; // array of data filled with all Data object read from database.
    
    1. Use JSON Framework to convert all data to JSON string. Notice that for the Data object, you have to override the proxyForJson method, since its a user defined object.

    You can make a JSON string from an object ,

    SBJsonWriter *writer = [SBJsonWriter new];
    NSString *jsonString = [writer stringWithObject:dataArray];
    [writer release];
    

    I am not sure if it works directly for array, if not, encapsulate your dataArray in anotherObject, and send that object to this JSON writer.

    Write the JSON string to a file.

     [jsonString writeToFile:path atomically:YES encoding:NSASCIIStringEncoding 
                 error:nil]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to ship some default data with my app. This data can be
Related to this SO question , I want to put the data loading in
What method do you use when you want to get performance data about specific
I have image data and i want to get a sub image of that
I want to get at the item that is being data bound, during the
table data of 2 columns category and subcategory i want to get a collection
We get these ~50GB data files consisting of 16 byte codes, and I want
My setup: I have a sqlite database from which I populate a NSMutableArray of
I'm trying to insert values on Android SQLite Database. The question is, I'm trying
I'm using JQuery to get city data from geonames. My problem is when I

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.