JsonRazor 1.3.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package JsonRazor --version 1.3.1                
NuGet\Install-Package JsonRazor -Version 1.3.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.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JsonRazor --version 1.3.1                
#r "nuget: JsonRazor, 1.3.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.3.1

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

1.3.1:

Changes to existing code:

  • JsonStream.StreamConverted<T>() generic class constraint was removed. Structs may now be used.
  • JsonArray value indexer will now throw ArgumentOutOfRangeException when index is greater or equal to value count.
  • JsonToken.GetFromPath() path first char that is type of token is now optional (but still correct to maintain compatibility) - with one exception - when path starts with array and immediately refers to next array, it can't be ommited. Example: [[{someProp

Fixes:

  • Deserializer wouldn't detect private constructors.
  • It probably hadn't been mentioned, but sinse 1.3.0 serialization of system types got more attention. Namely, KeyValuePair<TKey, TValue> and ValueTuple<T...> were proved to work. Sadly, Tuple<T...> class won't work, since it doesn't have default constructor and fields are readonly. If it wasn't the case, it most likely would. Structs have only constraint of fields being readonly.
  • Fixed rare error that could emerge when parsing via JsonStream.
  • Fixed another error that would make IToken corrupted. That would cause it to act as if arrays vanished (at least that was observed). There was also a possibility of exception being thrown when deserializing.
  • Fixed rare error that could make JsonArray lose or omit first value in certain scenario (mainly when it was null).
  • Fixed error with JsonArray.GetFromPath, when it received path that doesn't end with property.

New features:

  • I call it 'undefined type'. Let's say, You've got to store few possible classes in one place (object property, maybe array). But they differ in definition, so there's no base class or common field/prop surface is too small. It could be worked around by putting different prop types in object, and then check for presence of right one. But now comes a second solution. When field/property is of object type, a JsonObject or JsonArray that was parsed is put inside, so You may use it to selectively perform deserialization or data querying on it. List<object> or object[] could also be used as entrance type. When parsing happens with ITokens, still JsonTokens are put inside. Also serializer will use runtime type of object that's inside object field/prop.

Performance:

JsonStream caching strategy also got more attention. Investigation revelead that number of allocations could be reduced even further. In simple test scenario allocations of internal structure went from ~40 to 4. Also size of allocated memory was reduced and usage of structures was improved. In general, I'd expect JsonStream methods to consume less memory. It's hard to tell how this translates to speed, but lowering pressure on GC is also worth. Also some code paths have been marginally improved and old code was cleaned.

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 was computed.  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.

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 include de/serialization support for object and object[]. Important bug fixes. Go check changelog for all details.