void _loadObject(string json, ref int start) { do { ++start; string name = JsonUtil.GetString(json, ref start); if (name == null) { if (json[start] != JsonUtil.OBJECT_END) { throw new EasyJsonException("Bad JSON format"); } break; } else { JsonUtil.SkipIgnoredChar(json, ref start, false); if (start == json.Length) { throw new EasyJsonException("Bad JSON format"); } if (json[start] != JsonUtil.KV_SEPARATOR) { throw new EasyJsonException("Bad JSON format"); } ++start; EasyJsonData data = EasyJsonData.__load(json, ref start); _object.Add(name, data); JsonUtil.SkipIgnoredChar(json, ref start, false); if (start < json.Length) { if (json[start] == JsonUtil.DATA_SEPARATOR) { continue; } if (json[start] == JsonUtil.OBJECT_END) { break; } } throw new EasyJsonException("Bad JSON format"); } }while (true); ++start; }
void _loadArray(string json, ref int start) { bool allIsNull = true; do { ++start; EasyJsonData data = EasyJsonData.__load(json, ref start); _array.Add(data); if (!data.IsNullValue) { allIsNull = false; } JsonUtil.SkipIgnoredChar(json, ref start, false); if (start < json.Length) { if (json[start] == JsonUtil.DATA_SEPARATOR) { continue; } if (json[start] == JsonUtil.ARRAY_END) { break; } } throw new EasyJsonException("Bad JSON format"); }while (true); if (allIsNull) { _array.Clear(); } ++start; }