public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) { object obj2; string attribute = jsonReader.GetAttribute("type"); string key = attribute; if (key != null) { int num; if (<PrivateImplementationDetails>{D290E7C2-4296-4D66-A436-0C17851A078B}.$$method0x60012be-1.TryGetValue(key, out num)) { switch (num) { case 0: jsonReader.Skip(); obj2 = null; goto Label_011B; case 1: obj2 = jsonReader.ReadElementContentAsBoolean(); goto Label_011B; case 2: goto Label_00BB; case 3: obj2 = ParseJsonNumber(jsonReader.ReadElementContentAsString()); goto Label_011B; case 4: jsonReader.Skip(); obj2 = new object(); goto Label_011B; case 5: return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context); } } throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(System.Runtime.Serialization.SR.GetString("JsonUnexpectedAttributeValue", new object[] { attribute }))); } Label_00BB: obj2 = jsonReader.ReadElementContentAsString(); Label_011B: if (context != null) { context.AddNewObject(obj2); } return obj2; }
public override object ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) { object obj; string contentMode = jsonReader.GetAttribute(JsonGlobals.typeString); switch (contentMode) { case JsonGlobals.nullString: jsonReader.Skip(); obj = null; break; case JsonGlobals.booleanString: obj = jsonReader.ReadElementContentAsBoolean(); break; case JsonGlobals.stringString: case null: obj = jsonReader.ReadElementContentAsString(); break; case JsonGlobals.numberString: obj = ParseJsonNumber(jsonReader.ReadElementContentAsString()); break; case JsonGlobals.objectString: jsonReader.Skip(); obj = new object(); break; case JsonGlobals.arrayString: // Read as object array return DataContractJsonSerializer.ReadJsonValue(DataContract.GetDataContract(Globals.TypeOfObjectArray), jsonReader, context); default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.JsonUnexpectedAttributeValue, contentMode))); } if (context != null) { context.AddNewObject(obj); } return obj; }
protected override void StartReadExtensionDataValue(XmlReaderDelegator xmlReader) { _extensionDataValueType = xmlReader.GetAttribute(JsonGlobals.typeString); }