尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Nerdbank.Json is a UTF-8 JSON serializer being built in the same general shape as Nerdbank.MessagePack, but without layering on top of System.Text.Json, Newtonsoft.Json, or any other serializer.
The implementation includes low-level UTF-8 readers and writers, built-in converters for common .NET types, and PolyType-backed serialization for mutable and constructor-bound object graphs.
It supports incremental asynchronous streaming, reference preservation, unions, targeted deserialization, and JSON Schema generation.
It is allocation-conscious in the hot path and multi-targets net10.0, net472, and netstandard2.0.
IBufferWriter<byte>.GetSpan / Advance, plus overloaded stateless boolean and numeric primitives for all integer widths, single/double precision, and decimal.RawJson values with explicit borrowed/owned lifetimes and automatic owned deserialization.JsonNamingPolicy.ConverterContext.UnusedDataPacket.DeserializeEnumerableAsync and SerializeEnumerableAsync, with SequenceOptions selecting JsonSequenceFormat.NDJson or JsonSequenceFormat.JsonArray.DeserializePath by JSON path or member-access options, and DeserializePathEnumerableAsync for arrays selected inside an envelope.DerivedTypeUnions mappings, with array or $type metadata envelopes.System.Text.Json.Nodes.JsonObject, separate from the native JSON DOM.ExpandoObject, and System.Text.Json DOM converters.The current built-in serializer supports:
string, char, boolbyte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimalSystem.Numerics.BigIntegerDateTime, DateTimeOffset, TimeSpanGuid, Version, Uri, CultureInfo, Encodingbyte[], Memory<byte>, ReadOnlyMemory<byte>RawJson for exact UTF-8 token retentionSystem.Drawing.Color, System.Drawing.PointHalf, Int128, UInt128, DateOnly, TimeOnly, Runeusing Nerdbank.Json;
JsonSerializer serializer = new();
string json = serializer.Serialize(new DateTimeOffset(2024, 7, 1, 12, 34, 56, TimeSpan.Zero));
DateTimeOffset value = serializer.Deserialize<DateTimeOffset>(json);
For object graphs, annotate your root type with GenerateShape and use the same serializer APIs:
using Nerdbank.Json;
using PolyType;
[GenerateShape]
public partial class Person
{
public string? Name { get; set; }
public int Age { get; set; }
}
JsonSerializer serializer = new();
string json = serializer.Serialize(new Person { Name = "Ada", Age = 37 });
Person person = serializer.Deserialize<Person>(json);
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗