You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varreader=newUtf8JsonReader(Encoding.UTF8.GetBytes(json));// Copy the reader struct by value to avoid advancing the `reader`varpeakCopy=reader;Assert.True(peakCopy.Read());// Start reading the objectAssert.Equal(JsonTokenType.StartObject,peakCopy.TokenType);Assert.True(peakCopy.Read());Assert.Equal(JsonTokenType.PropertyName,peakCopy.TokenType);// Peak the property namevarpropertyName=peakCopy.GetString();if(propertyName=="$type"){// Assign the input ref to the peakreader=peakCopy;// Read the type valueAssert.True(reader.Read());Assert.Equal(JsonTokenType.String,reader.TokenType);vartypeName=reader.GetString();// Read the remaining properties for the descendent type here...}elseif(propertyName!=null){// Read the remaining properties for the descendent type here...varelement=JsonElement.ParseValue(refreader);// Get the $type propertyif(!element.TryGetProperty("$type",outvartypeName)){thrownewJsonException("Missing $type property.");}// Deserialize the `element` as the desired type}
The text was updated successfully, but these errors were encountered:
PoC:
The text was updated successfully, but these errors were encountered: