private static string WriteStringInternal(object value, Type type, JsonSerializerOptions options) { Span <byte> jsonBytes = WriteInternal(value, type, options); string stringJson = JsonReaderHelper.TranscodeHelper(jsonBytes); return(stringJson); }
private static string Serialize <TValue>(TValue value, Type inputType, JsonSerializerOptions?options) { if (options == null) { options = JsonSerializerOptions.s_defaultOptions; } using (var output = new PooledByteBufferWriter(options.DefaultBufferSize)) { using (var writer = new Utf8JsonWriter(output, options.GetWriterOptions())) { WriteCore(writer, value, inputType, options); } return(JsonReaderHelper.TranscodeHelper(output.WrittenMemory.Span)); } }