private Tuple <ParsedObject, int> ParseJsonObject(string text, int currentPoint) { ParsedObject parsedObject = new ParsedObject(ParsedObject.Type.NestedType); while (true) { Tuple <string, int> nextKey = GetJsonKey(text, currentPoint); currentPoint = nextKey.Item2 + 1; Tuple <ParsedObject, int> nextValue = GetJsonValue(text, currentPoint); currentPoint = nextValue.Item2; parsedObject.AddSubObjectByKey(nextKey.Item1, nextValue.Item1); while (gapSymbols.Contains(Convert.ToString(text[currentPoint]))) { currentPoint++; } if (text[currentPoint] == '}') { break; } currentPoint++; } return(new Tuple <ParsedObject, int>(parsedObject, currentPoint)); }
private ParsedObject Go() { ParsedObject newObject; if (!isNextSymbolIsBracket()) { newObject = new ParsedObject(ParsedObject.Type.SingleValue); newObject.SetValue(ReadTillBracket()); return(newObject); } newObject = new ParsedObject(ParsedObject.Type.NestedType); while (true) { string tag = ReadTag(); newObject.AddSubObjectByKey(tag, Go()); ReadTag(); // closing if (isNextTagIsClosing()) { break; } } return(newObject); }