JsonRazor 1.5.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package JsonRazor --version 1.5.1                
NuGet\Install-Package JsonRazor -Version 1.5.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonRazor" Version="1.5.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonRazor --version 1.5.1                
#r "nuget: JsonRazor, 1.5.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install JsonRazor as a Cake Addin
#addin nuget:?package=JsonRazor&version=1.5.1

// Install JsonRazor as a Cake Tool
#tool nuget:?package=JsonRazor&version=1.5.1                

1.5.1:

Changes to existing code:

  • Deserialization of not supported collection type (not T[] or List<T>) will now throw InvalidOperationException instead of returning null.
  • JsonArray's tokens are no longer grouped by type, as they are now in source order. First... properties continue to work.

Fixes:

  • JsonValue.Equals() wouldn't perform actual comparisons.
  • JsonComposite.FirstObject or FirstArray properties would sometimes return null when not parsed, regardless of token existance.
  • IToken.LoadTokens() would probably return tokens in reversed order on subsequent calls. Now array will always return source order. Order for object remains unchanged, but it may be subject to change; indexer is recommended way of accesing child tokens. Nevertheless, LoadTokens() will always return correct order on first enumeration, regardless of token type.
  • Very rare exception thrown during IToken parsing with long values.
  • Very rare error that would sometimes result in broken parsed data or exception when values contained \ escape sequences.
  • CodeGenDeserializer.ToType() could probably throw AccessException under .NET Framework.
  • JsonReader implements IDisposable.
  • Few documentation comments, that were obviously stating wrong, ie. Deserializer.UseInfo.

New features:

  • Added JsonValue.Equals(JsonValue).
  • Added JsonReader.Open(StreamReader) method. Its purpose is to make sure that internal structures will be released when parsing from stream finishes. It is recommended to call it inside using() block instead of creating new JsonReader, as it will not cause unnecessary allocations.
  • Added JsonArray.TokenAt(int) method, that returns token at given index. The index, at which token is returned, is equal to that of JsonToken.Index property.
  • CachingDeserializer.UseInternalParsing flag, that enables usage of experimental parsing algorithm. It can provide to 25% shorter execution time and probably no more than 30% reduction in memory usage (depends heavily on structure, data size etc.). It can't be used when model has any property/field or any collection of type object, that is to be populated with raw tokens. False by default. Has no effect on IToken deserialization with given instance.
  • CodeGenDeserializer instance can now be shared across multiple threads when deserializing from string to given type. Only requirement is that it must have performed deserialization for given type at least once before being shared.

Performance:

  • CodeGenDeserializer performance for subsequent deserializations has improved up to 30-40%. Also number of allocations should be lower. The tradeoff is that first deserialization for given type might be somewhat slower.
  • Deserialization to model containing nullable types has been improved up to 15%.
  • Multiple collection deserializations has been improved (lost actual measurements, around 10-15%). Also number of allocations is reduced.
  • List<T> deserialization has been improved for IToken around 5-10%.
  • Reduced allocation size of TokensWithNulls() enumerator.
  • Reduced allocation size of JsonObject and JsonArray. JsonObject deserialization allocations were also reduced.

While these changes look nice to me, I'm really looking forward to begin to work on final piece, a dedicated serialization engine for ASP.NET Core, that works on UTF8, removing the need for char - byte conversions. I'll try to aim for fastest serialization & deserialization out there.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net is compatible.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.0

    • No dependencies.
  • .NETCoreApp 2.1

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 1,334 2/6/2022
2.0.1-rc 854 12/11/2021
2.0.0-rc 1,011 7/4/2021
1.5.1 2,241 9/27/2019
1.5.0 1,377 7/27/2019
1.4.0 1,408 6/5/2019
1.3.1 1,594 1/25/2019
1.3.0 1,530 1/1/2019
1.2.2.8 1,916 7/6/2018
1.2.2.7 1,874 6/25/2018
1.2.2.6 1,735 6/9/2018
1.2.2.5 2,037 3/31/2018
1.2.2.2 1,926 10/7/2017
1.2.2.1 1,816 10/4/2017
1.2.2 1,851 10/1/2017
1.2.0.1 1,797 8/15/2017
1.1.0.10 1,933 6/25/2017

New features, bug fixes and performance improvements. Check changelog on nuget.org for details.