SkinnyJson 2.0.0

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

Install-Package SkinnyJson -Version 2.0.0
dotnet add package SkinnyJson --version 2.0.0
<PackageReference Include="SkinnyJson" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SkinnyJson --version 2.0.0
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:

  • Default: https://www.nuget.org/packages/SkinnyJson/
  • Strong-named: https://www.nuget.org/packages/SkinnyJson/

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:

  • Default: https://www.nuget.org/packages/SkinnyJson/
  • Strong-named: https://www.nuget.org/packages/SkinnyJson/

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

Converted to NetStandard 2.0, some bug fixes

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.0 65 12/1/2020
1.8.0 92 11/3/2020
1.7.0 336 7/3/2019
1.6.9 319 5/22/2019
1.6.8 273 5/22/2019
1.6.5 644 1/10/2019
1.6.4 243 1/10/2019
1.6.3 355 12/13/2018
1.6.2 258 11/24/2018
1.6.1 258 11/23/2018
1.6.0 238 11/23/2018
1.5.5 261 11/7/2018
1.5.0 288 8/24/2018
1.4.0 283 8/24/2018
1.3.2 299 8/14/2018
1.3.1 299 8/14/2018
1.3.0 374 7/25/2018
1.2.0 336 7/23/2018
1.0.3 409 6/27/2018
1.0.2 772 8/26/2014
1.0.1 479 8/20/2014
1.0.0 524 8/20/2014