예제 #1
0
		public JsonObject(CharStream csDataSource)
		{
			if(csDataSource == null) throw new ArgumentNullException("csDataSource");

			char chInit = csDataSource.ReadChar(true);
			if(chInit != '{') throw new JsonFormatException();

			while(true)
			{
				string strName = (new JsonString(csDataSource)).Value;

				char chSeparator = csDataSource.ReadChar(true);
				if(chSeparator != ':') throw new JsonFormatException();

				JsonValue jValue = new JsonValue(csDataSource);

				m_dict[strName] = jValue;

				char chNext = csDataSource.PeekChar(true);
				if(chNext == '}') break;
				else if(chNext == ',') csDataSource.ReadChar(true);
				else throw new JsonFormatException();
			}

			char chTerminator = csDataSource.ReadChar(true);
			if(chTerminator != '}') throw new JsonFormatException();
		}
예제 #2
0
		public JsonArray(JsonValue[] vValues)
		{
			if(vValues == null) throw new ArgumentNullException("vValues");

			m_values = vValues;
		}