SkinnyJson 2.0.2

A simple and small JSON (de)serialisation library, focused on simple interactions with contract-based workflows.

Install-Package SkinnyJson -Version 2.0.2
dotnet add package SkinnyJson --version 2.0.2
<PackageReference Include="SkinnyJson" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SkinnyJson --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SkinnyJson, 2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SkinnyJson as a Cake Addin
#addin nuget:?package=SkinnyJson&version=2.0.2

// Install SkinnyJson as a Cake Tool
#tool nuget:?package=SkinnyJson&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

SkinnyJson

Based on FastJson: https://github.com/mgholam/fastJSON

Nuget:

The default is usually ahead of the strong-named version. If you need an updated version of the Strong-Named package, please open a Github issue.

SkinnyJson has a simple interface, and handles interface based serialisation better than most other .Net json libraries. SkinnyJson was designed to handle Event Store messages, and is tuned to deal with situations where a common interface declaration is available, but the original serialised objects/types are not available.

To adjust settings globally, look in SkinnyJson.Json.DefaultParameters

Common use cases:

Deserialise a known type:

IMyInterface values = Json.Defrost<IMyInterface>(jsonString);

Serialise any object to JSON:

string jsonString = Json.Freeze(myObject);

Pretty print a JSON string: (there is also a streaming version for very large files)

var newString = Json.Beautify(oldString);

Create a deep copy of an object:

var newObject = Json.Clone(oldObject);

Deserialise to a dynamic type for unknown schemas:

dynamic obj = Json.DefrostDynamic(jsonString);
Console.WriteLine(obj.MyProperty.MyArray[4].Prop2()); // use `()` to read a value.
var missing = obj.NotHere.child.grandchild(); // results in null. Dynamic does null propagation.

obj.MyProperty.other = "hello"; // can update properties
var updatedJson = Json.Freeze(obj); // and serialise the result

Inline editing:

string newJson = Json.Edit(oldJson, d => {
    d.myProperty.updated = true;
    d.info.updates[0].dateTime = DateTime.Now.ToString();
});

See the test cases for deeper examples

SkinnyJson

Based on FastJson: https://github.com/mgholam/fastJSON

Nuget:

The default is usually ahead of the strong-named version. If you need an updated version of the Strong-Named package, please open a Github issue.

SkinnyJson has a simple interface, and handles interface based serialisation better than most other .Net json libraries. SkinnyJson was designed to handle Event Store messages, and is tuned to deal with situations where a common interface declaration is available, but the original serialised objects/types are not available.

To adjust settings globally, look in SkinnyJson.Json.DefaultParameters

Common use cases:

Deserialise a known type:

IMyInterface values = Json.Defrost<IMyInterface>(jsonString);

Serialise any object to JSON:

string jsonString = Json.Freeze(myObject);

Pretty print a JSON string: (there is also a streaming version for very large files)

var newString = Json.Beautify(oldString);

Create a deep copy of an object:

var newObject = Json.Clone(oldObject);

Deserialise to a dynamic type for unknown schemas:

dynamic obj = Json.DefrostDynamic(jsonString);
Console.WriteLine(obj.MyProperty.MyArray[4].Prop2()); // use `()` to read a value.
var missing = obj.NotHere.child.grandchild(); // results in null. Dynamic does null propagation.

obj.MyProperty.other = "hello"; // can update properties
var updatedJson = Json.Freeze(obj); // and serialise the result

Inline editing:

string newJson = Json.Edit(oldJson, d => {
    d.myProperty.updated = true;
    d.info.updates[0].dateTime = DateTime.Now.ToString();
});

See the test cases for deeper examples

Release Notes

Fix fallback process

Dependencies

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SkinnyJson:

Package Downloads
BearBonesMessaging
BearBones messaging: lower-level framework, part of a contract-interface based distributed event framework for .Net

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.2 103 5/24/2021
2.0.1 80 5/17/2021
2.0.0 695 12/1/2020
1.8.0 194 11/3/2020
1.7.0 467 7/3/2019
1.6.9 432 5/22/2019
1.6.8 385 5/22/2019
1.6.5 926 1/10/2019
1.6.4 383 1/10/2019
1.6.3 551 12/13/2018
1.6.2 399 11/24/2018
1.6.1 407 11/23/2018
1.6.0 381 11/23/2018
1.5.5 409 11/7/2018
1.5.0 445 8/24/2018
1.4.0 450 8/24/2018
1.3.2 465 8/14/2018
1.3.1 474 8/14/2018
1.3.0 526 7/25/2018
1.2.0 487 7/23/2018
1.0.3 565 6/27/2018
1.0.2 947 8/26/2014
1.0.1 639 8/20/2014
1.0.0 680 8/20/2014