private JsonNode Node() { JsonNode jnFinal = new JsonNode(); string sKey; object objValue = null; Match(JsonToken.TokenType.OpenCurly); while (m_jtCurToken.Type != JsonToken.TokenType.CloseCurly) { sKey = m_jtCurToken.Text; Match(JsonToken.TokenType.String); Match(JsonToken.TokenType.Colon); switch (m_jtCurToken.Type) { case JsonToken.TokenType.String: objValue = Value(); break; case JsonToken.TokenType.OpenCurly: objValue = Node(); break; case JsonToken.TokenType.OpenBracket: objValue = List(); break; } jnFinal.Add(sKey, objValue); //we've found a comma! continue parsing key/value pairs if (m_jtCurToken.Type == JsonToken.TokenType.Comma) Match(JsonToken.TokenType.Comma); } Match(JsonToken.TokenType.CloseCurly); return jnFinal; }
public JsonDocument(JsonNode jnInitNode) { m_jnObject = new JsonObject(jnInitNode); }