/// <summary> /// Return JSONArray for one row of data from the statement /// </summary> /// <param name="statement"></param> /// <returns></returns> private JArray GetDataFromRow(SQLiteStatement statement) { var row = new JArray(); int columnCount = statement.ColumnCount; for (int i = 0; i < columnCount; i++) { if (statement[i] != null && (statement.ColumnName(i).EndsWith(SoupCol) || statement.ColumnName(i).StartsWith(SoupCol))) { string raw = statement.GetText(i); row.Add(JObject.Parse(raw)); } else { object raw = GetObject(statement, i); if (raw != null) { long value; if (long.TryParse(raw.ToString(), out value)) { row.Add(new JValue(value)); } else { double dvalue; if (double.TryParse(raw.ToString(), out dvalue)) { row.Add(new JValue(dvalue)); } else { string rawString = raw.ToString(); if (rawString.Contains('{')) { try { row.Add(JObject.Parse(rawString)); } catch (Exception) { row.Add(raw.ToString()); } } else { row.Add(raw.ToString()); } } } } } } return(row); }