public static T LoadFromJson <T>(ReadOnlySpan <byte> buffer, ModelObject owner, ErrorCollector collector) where T : ModelObject { var reader = new Utf8JsonReader(buffer); reader.Read(); var context = new DeserializationContext(collector); var result = SerializationMap <T> .DeserializeFromJson(owner, ref reader, context); context.Notify(); return(result); }
public static T LoadFromJson <T>(byte[] buffer, ModelObject owner, ErrorCollector collector, int bufferLength = -1) where T : ModelObject { if (bufferLength == -1) { bufferLength = buffer.Length; } var reader = new Utf8JsonReader(new ReadOnlySequence <byte>(buffer, 0, bufferLength)); reader.Read(); var context = new DeserializationContext(collector); var result = SerializationMap <T> .DeserializeFromJson(owner, ref reader, context); context.Notify(); return(result); }