public JsonPair(string name, bool value) : this(name) { if (value) { Value = new JsonTrue(); } else { Value = new JsonFalse(); } }
public virtual void ReadJson(JsonReader reader) { if (null == reader) { throw new ArgumentNullException("reader"); } if (JsonNodeType.Object != reader.NodeType) { throw new InvalidOperationException(); } if (reader.IsEmptyObject) { reader.Read(); return; } string name = null; while (reader.Read()) { JsonValue value = null; switch (reader.NodeType) { case JsonNodeType.Name: name = reader.Name; break; case JsonNodeType.NullValue: value = new JsonNull(); break; case JsonNodeType.TrueValue: value = new JsonTrue(); break; case JsonNodeType.FalseValue: value = new JsonFalse(); break; case JsonNodeType.NumberValue: value = new JsonNumber(reader.Value); break; case JsonNodeType.StringValue: value = new JsonString(reader.Value); break; case JsonNodeType.Array: value = ReadJsonArray(reader); break; case JsonNodeType.Object: var obj = new JsonObject(); obj.ReadJson(reader); value = obj; break; case JsonNodeType.EndObject: return; } if (null != value) { Add(name, value); } } }