public List<JSONObject> SplitObjects(string JSON)
{
List<JSONObject> output = new List<JSONObject>();
bool insideSingle = false;
bool insideDouble = false;
string buffer = "";
for (int x = 0; x < JSON.Length; x++)
{
switch (JSON[x])
{
case '\'':
insideSingle = !insideSingle;
buffer += JSON[x];
break;
case '"':
insideDouble = !insideDouble;
buffer += JSON[x];
break;
case ',':
if (!insideSingle && !insideDouble)
{
output.Add(new JSONObject() { Raw = buffer });
buffer = "";
}
else
{
buffer += JSON[x];
}
break;
default:
buffer += JSON[x];
break;
}
}
output.Add(new JSONObject() { Raw = buffer });
return output;
}