11 Replies - 12622 Views - Last Post: 12 October 2014 - 08:18 PM Rate Topic: -----

#1 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

.JSON to .SQLite

Posted 09 October 2014 - 06:58 PM

Hi all, new to databasing. I just learned how to use SQLite for my C# application (very easy!)

But now I have a need to put 40 megabytes of JSON strings into an SQLite database for app consumption.

First off, I can't even figure out how to open the JSON file to begin with. I tried an online JSON-CSV converter but it spit out the data into two rows and more than 16,384 columns to where Excel cannot open it. It seems even if it were two columns and 16,384 rows, the data is not organized that simply. Right now the top cell is a Key describing what the data is by some convention, and the cell below it is the value.

Is there a program I can use that will parse this data into a readable format and perhaps let me map columns and stuff?

Edit: Currently looking at JSON Viewer. It's giving me a better idea of how the data is organized. I'm starting to think I should just write a console application to do what I want. Of course if there is an app made for this I wish I knew about it :whatsthat: :whatsthat:

This post has been edited by wartimespark: 09 October 2014 - 07:12 PM


Is This A Good Question/Topic? 0
  • +

Replies To: .JSON to .SQLite

#2 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 09 October 2014 - 09:14 PM

Luckily I didn't get too far writing a parser before I found Adventures in JSON parsing with C#

:wheelchair: :wheelchair: :wheelchair:
Was This Post Helpful? 0
  • +
  • -

#3 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 10 October 2014 - 09:32 AM

Attached Image

So, I whipped up a lil sumn sumn to iterate through all that JSON soup and came up with something I'm happy with.

But, for some reason, if there are certain characters in the text it just doesn't come through right.

mtgjson.com said:

All JSON files are UTF8 encoded. There are UTF8 characters (such as Ęther Adept) in many of the files.


Fair enough,

Encoding utf8 = new UTF8Encoding(true, true);

string jsonString;

using(StreamReader streamReader = new StreamReader("allsets.txt", utf8))
{
jsonString = streamReader.ReadToEnd();
}



And,

Attached Image

What accommodations am I missing for UTF8?

Full code (800 lines):
using System;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.IO;
using System.Text;
using System.Data.SQLite;

namespace JsonToSqlTry0
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.WriteLine("DB file name: ");
            string dbFileName = "DB.sqlite";
                //Console.ReadLine();
            //Console.WriteLine("DB table: ");
            string dbTable = "AllCardsDB";
                //Console.ReadLine();
            string sqliteConnectionString = "Data Source=" + dbFileName + ";Version=3;";
            SQLiteConnection dbConnection = new SQLiteConnection(sqliteConnectionString);
            BuildSQLiteDB(dbConnection, dbTable);
            Console.ReadLine();
        }

        static void BuildSQLiteDB(SQLiteConnection dbConnection, string dbTable)
        {
            Encoding utf8 = new UTF8Encoding(true, true);

            string jsonString;

            using(StreamReader streamReader = new StreamReader("allsets.txt", utf8))
            {
                jsonString = streamReader.ReadToEnd();
            }

            JObject json = JObject.Parse(jsonString);

            foreach (JToken setsArray in json.Children())
            {
                foreach (var setInfoObject in setsArray.Children())
                {
                    #region create set variables
                    string edition = (string)setInfoObject["name"];
                    string editioncode = (string)setInfoObject["code"];
                    #endregion

                    JToken cardsArray = setInfoObject["cards"];
                    foreach (var cardObject in cardsArray)
                    {
                        #region create card variables
                        string name = null;
                        string fulltype = null;
                        string type0 = null;
                        string type1 = null;
                        string type2 = null;
                        string type3 = null;
                        string subtype0 = null;
                        string subtype1 = null;
                        string subtype2 = null;
                        string subtype3 = null;
                        string supertype0 = null;
                        string supertype1 = null;
                        int colorred = 0;
                        int colorblue = 0;
                        int colorgreen = 0;
                        int colorwhite = 0;
                        int colorblack = 0;
                        int cmc = 0;
                        string manacost = null;
                        int rarity = 0;
                        string artist = null;
                        string rules = null;
                        string imagename = null;
                        string layout = null;
                        int multiverseid = 0;
                        int reserved = 0;
                        string flavor = null;
                        string power = null;
                        string toughness = null;
                        int legalitylegacy = 0;
                        int legalityvintage = 0;
                        int legalitycommander = 0;
                        int legalitystandard = 0;
                        int legalitymodern = 0;
                        int legalitysingleton100 = 0;
                        string rulings = null;                        
                        #endregion

                        #region populate card variables
                        if (cardObject["name"] != null)
                        {
                            name = (string)cardObject["name"];
                        }

                        if (cardObject["type"] != null)
                        {
                            fulltype = (string)cardObject["type"];
                        }

                        if (cardObject["cmc"] != null)
                        {
                            cmc = (int)cardObject["cmc"];
                        }

                        if (cardObject["manaCost"] != null)
                        {
                            manacost = (string)cardObject["manaCost"];
                        }

                        if (cardObject["artist"] != null)
                        {
                            artist = (string)cardObject["artist"];
                        }

                        if (cardObject["text"] != null)
                        {
                            rules = (string)cardObject["text"];
                        }

                        if (cardObject["imageName"] != null)
                        {
                            imagename = (string)cardObject["imageName"];
                        }

                        if (cardObject["layout"] != null)
                        {
                            layout = (string)cardObject["layout"];
                        }

                        if (cardObject["multiverseid"] != null)
                        {
                            multiverseid = (int)cardObject["multiverseid"];
                        }

                        if (cardObject["flavor"] != null)
                        {
                            flavor = (string)cardObject["flavor"];
                        }

                        if (cardObject["power"] != null)
                        {
                            power = (string)cardObject["power"];
                        }

                        if (cardObject["toughness"] != null)
                        {                            
                            toughness = (string)cardObject["toughness"];
                        }
                        
                        JToken typesJArray = cardObject["types"];
                        if (typesJArray != null)
                        {
                            foreach (var typeObject in typesJArray.Children())
                            {
                                #region type iterator
                                if (type0 == null)
                                {
                                    type0 = (string)typeObject;
                                    continue;
                                }

                                else if (type1 == null)
                                {
                                    type1 = (string)typeObject;
                                    continue;
                                }

                                else if (type2 == null)
                                {
                                    type2 = (string)typeObject;
                                    continue;
                                }

                                else if (type3 == null)
                                {
                                    type3 = (string)typeObject;
                                    continue;
                                }
                                #endregion
                            }
                        }                        

                        JToken subtypesJArray = cardObject["subtypes"];
                        if (subtypesJArray != null)
                        {
                            foreach (var subtypeObject in subtypesJArray.Children())
                            {
                                #region subtype iterator
                                if (subtype0 == null)
                                {
                                    subtype0 = (string)subtypeObject;
                                    continue;
                                }

                                else if (subtype1 == null)
                                {
                                    subtype1 = (string)subtypeObject;
                                    continue;
                                }

                                else if (subtype2 == null)
                                {
                                    subtype2 = (string)subtypeObject;
                                    continue;
                                }

                                else if (subtype3 == null)
                                {
                                    subtype3 = (string)subtypeObject;
                                    continue;
                                }
                                #endregion
                            }
                        }                        

                        JToken supertypesJArray = cardObject["supertypes"];
                        if (supertypesJArray != null)
                        {
                            foreach (var supertypeObject in supertypesJArray.Children())
                            {
                                #region supertype iterator
                                if (supertype0 == null)
                                {
                                    supertype0 = (string)supertypeObject;
                                    continue;
                                }

                                else if (supertype1 == null)
                                {
                                    supertype1 = (string)supertypeObject;
                                    continue;
                                }
                                #endregion
                            }
                        }                        

                        JToken colorsJArray = cardObject["colors"];
                        if (colorsJArray != null)
                        {
                            foreach (var colorObject in colorsJArray.Children())
                            {
                                #region color iterator
                                if ((string)colorObject == "Black")
                                {
                                    colorblack = 1;
                                    continue;
                                }

                                if ((string)colorObject == "Blue")
                                {
                                    colorblue = 1;
                                    continue;
                                }

                                if ((string)colorObject == "Red")
                                {
                                    colorred = 1;
                                    continue;
                                }

                                if ((string)colorObject == "Green")
                                {
                                    colorgreen = 1;
                                    continue;
                                }

                                if ((string)colorObject == "White")
                                {
                                    colorwhite = 1;
                                    continue;
                                }
                                #endregion
                            }
                        }                        

                        JToken rarityToken = cardObject["rarity"];
                        if (rarityToken != null)
                        {
                            
                            #region rarity iterator
                            if ((string)rarityToken == "Common")
                            {
                                rarity = 0;
                            }

                            else if ((string)rarityToken == "Uncommon")
                            {
                                rarity = 1;
                            }

                            else if ((string)rarityToken == "Rare")
                            {
                                rarity = 2;
                            }

                            else if ((string)rarityToken == "Mythic Rare")
                            {
                                rarity = 3;
                            }
                            #endregion

                        }                        

                        JToken reservedToken = cardObject["reserved"];
                        if (reservedToken != null)
                        {
                            if ((string)reservedToken == "true")
                            {
                                reserved = 1;
                            }
                        }                        

                        JToken legalitiesJArray = cardObject["legalities"];
                        if (legalitiesJArray != null)
                        {
                            foreach (var legalityObject in legalitiesJArray)
                            {
                                #region legalities iterator
                                if ((string)legalityObject == "Standard")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Standard"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalitystandard = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalitystandard = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalitystandard = 0;
                                        continue;
                                    }

                                    continue;
                                }

                                if ((string)legalityObject == "Modern")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Modern"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalitymodern = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalitymodern = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalitymodern = 0;
                                        continue;
                                    }

                                    continue;
                                }

                                if ((string)legalityObject == "Vintage")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Vintage"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalityvintage = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalityvintage = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalityvintage = 0;
                                        continue;
                                    }

                                    continue;
                                }

                                if ((string)legalityObject == "Legacy")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Legacy"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalitylegacy = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalitylegacy = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalitylegacy = 0;
                                        continue;
                                    }

                                    continue;
                                }

                                if ((string)legalityObject == "Commander")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Commander"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalitycommander = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalitycommander = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalitycommander = 0;
                                        continue;
                                    }

                                    continue;
                                }

                                if ((string)legalityObject == "Singleton 100")
                                {
                                    JToken legalityObjectFormatToken = legalityObject["Singleton 100"];
                                    if ((string)legalityObjectFormatToken == "Legal")
                                    {
                                        legalitysingleton100 = 2;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Restricted")
                                    {
                                        legalitysingleton100 = 1;
                                        continue;
                                    }

                                    else if ((string)legalityObjectFormatToken == "Banned")
                                    {
                                        legalitysingleton100 = 0;
                                        continue;
                                    }

                                    continue;
                                }
                                #endregion
                            }
                        }
                        

                        JToken rulingsJArray = cardObject["rulings"];
                        if (rulingsJArray != null)
                        {
                            StringBuilder sb = new StringBuilder();
                            foreach (var rulingObject in rulingsJArray)
                            {
                                #region rulings iterator
                                string rulingObjectDate = (string)rulingObject["date"];
                                string rulingObjectRuling = (string)rulingObject["text"];
                                sb.AppendLine(rulingObjectDate);
                                sb.AppendLine(rulingObjectRuling);
                                sb.AppendLine();
                                #endregion
                            }
                            rulings = sb.ToString();
                        }
                        #endregion

                        StringBuilder sqlCommandStringBuild = new StringBuilder();
                        sqlCommandStringBuild.Append("INSERT INTO " + dbTable + " (");

                        #region append appropriate fields
                        if (name != null)
                        {
                            sqlCommandStringBuild.Append("name, ");
                        }

                        if (edition != null)
                        {
                            sqlCommandStringBuild.Append("edition, ");
                        }

                        if (editioncode != null)
                        {
                            sqlCommandStringBuild.Append("editioncode, ");
                        }

                        if (fulltype != null)
                        {
                            sqlCommandStringBuild.Append("fulltype, ");
                        }

                        if (type0 != null)
                        {
                            sqlCommandStringBuild.Append("type0, ");
                        }

                        if (type1 != null)
                        {
                            sqlCommandStringBuild.Append("type1, ");
                        }

                        if (type2 != null)
                        {
                            sqlCommandStringBuild.Append("type2, ");
                        }

                        if (type3 != null)
                        {
                            sqlCommandStringBuild.Append("type3, ");
                        }

                        if (subtype0 != null)
                        {
                            sqlCommandStringBuild.Append("subtype0, ");
                        }

                        if (subtype1 != null)
                        {
                            sqlCommandStringBuild.Append("subtype1, ");
                        }

                        if (subtype2 != null)
                        {
                            sqlCommandStringBuild.Append("subtype2, ");
                        }

                        if (subtype3 != null)
                        {
                            sqlCommandStringBuild.Append("subtype3, ");
                        }

                        if (supertype0 != null)
                        {
                            sqlCommandStringBuild.Append("supertype0, ");
                        }

                        if (supertype1 != null)
                        {
                            sqlCommandStringBuild.Append("supertype1, ");
                        }

                        sqlCommandStringBuild.Append("colorred, ");

                        sqlCommandStringBuild.Append("colorblue, ");

                        sqlCommandStringBuild.Append("colorgreen, ");

                        sqlCommandStringBuild.Append("colorwhite, ");

                        sqlCommandStringBuild.Append("colorblack, ");

                        sqlCommandStringBuild.Append("cmc, ");

                        if (manacost != null)
                        {
                            sqlCommandStringBuild.Append("manacost, ");
                        }

                        sqlCommandStringBuild.Append("rarity, ");

                        if (artist != null)
                        {
                            sqlCommandStringBuild.Append("artist, ");
                        }

                        if (rules != null)
                        {
                            sqlCommandStringBuild.Append("rules, ");
                        }

                        if (imagename != null)
                        {
                            sqlCommandStringBuild.Append("imagename, ");
                        }

                        if (layout != null)
                        {
                            sqlCommandStringBuild.Append("layout, ");
                        }

                        sqlCommandStringBuild.Append("multiverseid, ");

                        sqlCommandStringBuild.Append("reserved, ");

                        if (flavor != null)
                        {
                            sqlCommandStringBuild.Append("flavor, ");
                        }

                        if (power != null)
                        {
                            sqlCommandStringBuild.Append("power, ");
                        }

                        if (toughness != null)
                        {
                            sqlCommandStringBuild.Append("toughness, ");
                        }

                        if (rulings != null)
                        {
                            sqlCommandStringBuild.Append("rulings, ");
                        }

                        sqlCommandStringBuild.Append("legalitylegacy, ");

                        sqlCommandStringBuild.Append("legalityvintage, ");

                        sqlCommandStringBuild.Append("legalitycommander, ");

                        sqlCommandStringBuild.Append("legalitystandard, ");

                        sqlCommandStringBuild.Append("legalitymodern, ");

                        sqlCommandStringBuild.Append("legalitysingleton100)");
                        #endregion

                        sqlCommandStringBuild.Append(" VALUES (");

                        #region append appropriate values
                        if (name != null)
                        {
                            sqlCommandStringBuild.Append("'" + name + "', ");
                        }

                        if (edition != null)
                        {
                            sqlCommandStringBuild.Append("'" + edition + "', ");
                        }

                        if (editioncode != null)
                        {
                            sqlCommandStringBuild.Append("'" + editioncode + "', ");
                        }

                        if (fulltype != null)
                        {
                            sqlCommandStringBuild.Append("'" + fulltype + "', ");
                        }

                        if (type0 != null)
                        {
                            sqlCommandStringBuild.Append("'" + type0 + "', ");
                        }

                        if (type1 != null)
                        {
                            sqlCommandStringBuild.Append("'" + type1 + "', ");
                        }

                        if (type2 != null)
                        {
                            sqlCommandStringBuild.Append("'" + type2 + "', ");
                        }

                        if (type3 != null)
                        {
                            sqlCommandStringBuild.Append("'" + type3 + "', ");
                        }

                        if (subtype0 != null)
                        {
                            sqlCommandStringBuild.Append("'" + subtype0 + "', ");
                        }

                        if (subtype1 != null)
                        {
                            sqlCommandStringBuild.Append("'" + subtype1 + "', ");
                        }

                        if (subtype2 != null)
                        {
                            sqlCommandStringBuild.Append("'" + subtype2 + "', ");
                        }

                        if (subtype3 != null)
                        {
                            sqlCommandStringBuild.Append("'" + subtype3 + "', ");
                        }

                        if (supertype0 != null)
                        {
                            sqlCommandStringBuild.Append("'" + supertype0 + "', ");
                        }

                        if (supertype1 != null)
                        {
                            sqlCommandStringBuild.Append("'" + supertype1 + "', ");
                        }

                        sqlCommandStringBuild.Append(colorred.ToString() + ", ");

                        sqlCommandStringBuild.Append(colorblue.ToString() + ", ");

                        sqlCommandStringBuild.Append(colorgreen.ToString() + ", ");

                        sqlCommandStringBuild.Append(colorwhite.ToString() + ", ");

                        sqlCommandStringBuild.Append(colorblack.ToString() + ", ");

                        sqlCommandStringBuild.Append(cmc.ToString() + ", ");

                        if (manacost != null)
                        {
                            sqlCommandStringBuild.Append("'" + manacost + "', ");
                        }

                        sqlCommandStringBuild.Append(rarity.ToString() + ", ");

                        if (artist != null)
                        {
                            sqlCommandStringBuild.Append("'" + artist + "', ");
                        }

                        if (rules != null)
                        {
                            sqlCommandStringBuild.Append("'" + rules + "', ");
                        }

                        if (imagename != null)
                        {
                            sqlCommandStringBuild.Append("'" + imagename + "', ");
                        }

                        if (layout != null)
                        {
                            sqlCommandStringBuild.Append("'" + layout + "', ");
                        }

                        sqlCommandStringBuild.Append(multiverseid.ToString() + ", ");

                        sqlCommandStringBuild.Append(reserved.ToString() + ", ");

                        if (flavor != null)
                        {
                            sqlCommandStringBuild.Append("'" + flavor + "', ");
                        }

                        if (power != null)
                        {
                            sqlCommandStringBuild.Append("'" + power + "', ");
                        }

                        if (toughness != null)
                        {
                            sqlCommandStringBuild.Append("'" + toughness + "', ");
                        }

                        if (rulings != null)
                        {
                            sqlCommandStringBuild.Append("'" + rulings + "', ");
                        }

                        sqlCommandStringBuild.Append(legalitylegacy.ToString() + ", ");

                        sqlCommandStringBuild.Append(legalityvintage.ToString() + ", ");

                        sqlCommandStringBuild.Append(legalitycommander.ToString() + ", ");

                        sqlCommandStringBuild.Append(legalitystandard.ToString() + ", ");

                        sqlCommandStringBuild.Append(legalitymodern.ToString() + ", ");

                        sqlCommandStringBuild.Append(legalitysingleton100.ToString() + ")");
                        #endregion

                        string sqlCommandString = sqlCommandStringBuild.ToString();

                        //Console.WriteLine(sqlCommandString);
                        //Console.WriteLine();
                        //using (StreamWriter file = new StreamWriter(@"C:\WriteLines.txt", true, utf8))
                        //{
                        //    file.WriteLine(sqlCommandString);
                        //}
                        //Console.ReadLine();

                        WriteToDB(dbConnection, sqlCommandString);

                        Console.WriteLine(edition + " - " + name);
                    }
                }
            }
        }

        static void WriteToDB(SQLiteConnection dbConnection, string sqlCommandString)
        {
            SQLiteCommand sqlCommand = new SQLiteCommand(sqlCommandString, dbConnection);
            dbConnection.Open();
            sqlCommand.ExecuteNonQuery();
            dbConnection.Close();
        }
    }
}



Was This Post Helpful? 0
  • +
  • -

#4 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 10 October 2014 - 02:39 PM

Woot upgraded to the C# board from Databases :gun_bandana: :gun_bandana: ! Maybe you guys know what's up with my UTF8 woes.

I know I answered my previous questions fairly quickly, but I'm really stuck on this encoding thing!

Does the data stay UTF8 when put inside a regular string like I demonstrate above?
Was This Post Helpful? 0
  • +
  • -

#5 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:12 PM

:tank:

This post has been edited by wartimespark: 10 October 2014 - 08:13 PM

Was This Post Helpful? -1
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14929
  • View blog
  • Posts: 59,620
  • Joined: 12-June 08

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:15 PM

Please do not needlessly bump your thread especially when you are still on the front page and the last post was only a few hours ago.

Remember - this is a volunteer forum. Folks are not at your beck and call, and will reply to threads when they have time for a reply. Trying to force something with endless bumps is not the way to go.
Was This Post Helpful? 2
  • +
  • -

#7 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:18 PM

:tank:

This post has been edited by wartimespark: 10 October 2014 - 08:13 PM

Was This Post Helpful? -1
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14929
  • View blog
  • Posts: 59,620
  • Joined: 12-June 08

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:21 PM

I am pretty sure I am responding to the overt understanding that came with the "Shameless bump." portion.
Was This Post Helpful? 0
  • +
  • -

#9 wartimespark   User is offline

  • D.I.C Head


Reputation: -4
  • View blog
  • Posts: 82
  • Joined: 05-September 14

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:24 PM

:tank:

This post has been edited by wartimespark: 10 October 2014 - 08:13 PM

Was This Post Helpful? -1
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14929
  • View blog
  • Posts: 59,620
  • Joined: 12-June 08

Re: .JSON to .SQLite

Posted 10 October 2014 - 06:26 PM

Chalk it up to a learning lesson.
Was This Post Helpful? 0
  • +
  • -

#11 caffienehippy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-October 14

Re: .JSON to .SQLite

Posted 11 October 2014 - 01:09 PM

I have had a similar problem before. You didn't mention what you are using the view the SQLite database, but try accessing it with a different viewer or query the database from your code -- that should return properly encoded values.
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 6839
  • View blog
  • Posts: 23,216
  • Joined: 05-May 12

Re: .JSON to .SQLite

Posted 12 October 2014 - 08:18 PM

Can you post a portion of the "allsets.txt" file, or provide a link to it. Better yet, can you do a hexdump of the "allsets.txt" file and post part of the results?

I have a feeling that the data is not really UTF8 encoded.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1