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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:17:01+00:00 2026-06-08T18:17:01+00:00

I need to store JSONArray in sqlite here is how I Parse it to

  • 0

I need to store JSONArray in sqlite here is how I Parse it to String to store in SQLite

DataBase dba = new DataBase(getActivity(), "moduleDesc");
                    JSONObject mModule = CommonUtility.getDescribeObject(
                            mSP, "describe", mModuleName);
                    boolean deleteable = mModule.getBoolean("deleteable");
                    int flag = (deleteable) ? 1 : 0;
                    boolean createable = mModule.getBoolean("createable");
                    int flag1 = (createable) ? 1 : 0;
                    boolean updateable = mModule.getBoolean("updateable");
                    int flag2 = (updateable) ? 1 : 0;
                    String name = mModule.getString("name");
                    String label = mModule.getString("label");
                    String labelFields = mModule.getString("labelFields");
                    JSONArray mFields = mModule.getJSONArray("fields");
                    String fields = mFields.toString();
                    boolean exists = dba.Exists(name);
                    if (exists == false) {
                        dba.insertintomoduleDesc(flag, flag1, flag2, name,
                                labelFields, label,fields);
                    }
                    dba.close();

now i convert it back as

DataBase dba = new DataBase(con);
    cur = dba.getmod(moduleName);
     mIsCreatable = cur.getInt(cur.getColumnIndex("createable"));
     mIsUpdateable = cur.getInt(cur.getColumnIndex("updateable"));
     mIsDeletable = cur.getInt(cur.getColumnIndex("deleteable"));
     mName = cur.getString(cur.getColumnIndex("name"));
     mLabel = cur.getString(cur.getColumnIndex("label"));
     mLabelFields = cur.getString(cur.getColumnIndex("labelfields"));
     String fields = cur.getString(cur.getColumnIndex("fields"));
     mFields = fields.toJSONArray();

It says toJSONArray() is undefined for string but my Jsonarray is parsing and getting stored in sqlite
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-06-08T18:17:02+00:00Added an answer on June 8, 2026 at 6:17 pm
     String strFields = cur.getString(cur.getColumnIndex("fields"));
     mFields = fields.toJSONArray();
    

    Instead of above, You can create JSONArray from String by using:

    JSONArray mFields = new JSONArray(strFields);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need store multiple currencies on my database... Here's the problem: Example Tables: [
I need to store a JSONArray object as a string then retrieve the string
I need to store GPS coordinates in a database. I've heard that floats are
I need to store lotto numbers in a SQL database. There are 8 separate
I need to store a large number of geocoordiantes in a database in a
I need to store an object content in Sqlite. I was wondering which was
I need to store currency exchange rate data in the SQL 2008 database. I
I need to store a double as a string. I know I can use
I need to store products for an e-commerce solution in a database. Each product
I need to store a very big amount of text in mysql database. It

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.