public static List<JSONObjectOLD> GetObjects(string Input)
{
List<JSONObjectOLD> output = new List<JSONObjectOLD>();
StringBuilder buffer = new StringBuilder();
Input = Input.RemoveIfFirst('[').RemoveIfLast(']');
int counter = 0;
bool insideB = false;
int depth = 0;
for (int x = 0; x < Input.Length; x++)
{
switch (Input[x])
{
case '{':
if (depth > 0) { buffer.Append('{'); }
depth++;
break;
case '}':
depth--;
if (depth > 0) { buffer.Append('}'); }
break;
//case '[':
//case ']':
// insideBr = !insideBr;
// buffer.Append(Input[x]);
// break;
case ',':
if (depth == 0)
{
JSONObjectOLD o = new JSONObjectOLD();
o.Name = counter.ToString();
counter++;
o.Raw = buffer.ToString();
buffer = new StringBuilder();
o.ParseRaw();
output.Add(o);
}
else
{
buffer.Append(',');
}
break;
default:
buffer.Append(Input[x]);
break;
}
}
if (buffer.Length > 0)
{
JSONObjectOLD o = new JSONObjectOLD();
o.Name = counter.ToString();
o.Raw = buffer.ToString();
o.ParseRaw();
output.Add(o);
}
return output;
}