public override JsonNode this[String key] { get { return new JsonLazyCreator(this, key); } set { var tmp = new JsonClass(); tmp.Add(key, value); Set(tmp); } }
public override void Add(string key, JsonNode item) { var tmp = new JsonClass(); tmp.Add(key, item); Set(tmp); }
public static JsonNode Deserialize(System.IO.BinaryReader reader) { var type = (JsonBinaryTag)reader.ReadByte(); switch(type) { case JsonBinaryTag.Array: { var count = reader.ReadInt32(); var tmp = new JsonArray(); for(var i = 0; i < count; i++) tmp.Add(Deserialize(reader)); return tmp; } case JsonBinaryTag.Class: { var count = reader.ReadInt32(); var tmp = new JsonClass(); for(int i = 0; i < count; i++) { string key = reader.ReadString(); var val = Deserialize(reader); tmp.Add(key, val); } return tmp; } case JsonBinaryTag.Value: { return new JsonData(reader.ReadString()); } case JsonBinaryTag.IntValue: { return new JsonData(reader.ReadInt32()); } case JsonBinaryTag.DoubleValue: { return new JsonData(reader.ReadDouble()); } case JsonBinaryTag.BoolValue: { return new JsonData(reader.ReadBoolean()); } case JsonBinaryTag.FloatValue: { return new JsonData(reader.ReadSingle()); } default: { throw new Exception("Error deserializing JSON. Unknown tag: " + type); } } }