SkinnyJson 2.1.0
Install-Package SkinnyJson -Version 2.1.0
dotnet add package SkinnyJson --version 2.1.0
<PackageReference Include="SkinnyJson" Version="2.1.0" />
paket add SkinnyJson --version 2.1.0
#r "nuget: SkinnyJson, 2.1.0"
// Install SkinnyJson as a Cake Addin
#addin nuget:?package=SkinnyJson&version=2.1.0
// Install SkinnyJson as a Cake Tool
#tool nuget:?package=SkinnyJson&version=2.1.0
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
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen40 tizen60 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
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 | Downloads | Last updated |
---|---|---|
2.1.0 | 69 | 3/7/2022 |
2.0.3 | 53 | 3/4/2022 |
2.0.2 | 211 | 5/24/2021 |
2.0.1 | 168 | 5/17/2021 |
2.0.0 | 2,643 | 12/1/2020 |
1.8.0 | 257 | 11/3/2020 |
1.7.0 | 627 | 7/3/2019 |
1.6.9 | 598 | 5/22/2019 |
1.6.8 | 516 | 5/22/2019 |
1.6.5 | 1,369 | 1/10/2019 |
1.6.4 | 463 | 1/10/2019 |
1.6.3 | 799 | 12/13/2018 |
1.6.2 | 492 | 11/24/2018 |
1.6.1 | 498 | 11/23/2018 |
1.6.0 | 468 | 11/23/2018 |
1.5.5 | 510 | 11/7/2018 |
1.5.0 | 558 | 8/24/2018 |
1.4.0 | 569 | 8/24/2018 |
1.3.2 | 581 | 8/14/2018 |
1.3.1 | 607 | 8/14/2018 |
1.3.0 | 635 | 7/25/2018 |
1.2.0 | 592 | 7/23/2018 |
1.0.3 | 679 | 6/27/2018 |
1.0.2 | 1,081 | 8/26/2014 |
1.0.1 | 786 | 8/20/2014 |
1.0.0 | 813 | 8/20/2014 |
Improvements to case sensitivity and switching settings.