JSLTSharp 1.2.0-preview-58
See the version list below for details.
dotnet add package JSLTSharp --version 1.2.0-preview-58
NuGet\Install-Package JSLTSharp -Version 1.2.0-preview-58
<PackageReference Include="JSLTSharp" Version="1.2.0-preview-58" />
paket add JSLTSharp --version 1.2.0-preview-58
#r "nuget: JSLTSharp, 1.2.0-preview-58"
// Install JSLTSharp as a Cake Addin #addin nuget:?package=JSLTSharp&version=1.2.0-preview-58&prerelease // Install JSLTSharp as a Cake Tool #tool nuget:?package=JSLTSharp&version=1.2.0-preview-58&prerelease
JSLTSharp
This library let you to apply some transformations on a json object. Like an xslt document, transform a json string to another
I have created this library in .NET which enables the transformation of JSON documents using very a simple transformation language like an xslt transformation for XML document, but for JSON. I've also created this package as the excellent https://github.com/WorkMaze/JUST.net package does not responds exactly to my needs, and in case of big volumetry of data, performances was not good for my needs.
==========
Onboarding Instructions
Installation
- Add nuget package:
Install-Package JSLTSharp
- In your application, you must instanciate a new JsonTransform object, and call the method 'Transform' to transform your json:
var input = @"{
'field1': 13246.51,
'field2': true
}";
var transformation = @"{
'resultField1': '$.field1->ToInteger()',
'resultField2': '$.field2'
}";
var transformEngine = new JsonTransform();
var result = transformEngine.Transform(input, transformation);
result value :
{
"resultField1": 13246,
"resultField2": true
}
Selectors
In your transformation description, you can refers to fields by using a JsonPath expression
Ex :
{
"resultField1": "$.field1->ToInteger()",
"resultField2": "$.field2"
}
$.field1 refers to to the property named field1 on the json input.
âšī¸ If you have to test your selector, you can use the online tool https://jsonpath.com/.
Create my own function
The package can be extended by using your own functions. Code your own C# function, and register it on the service collection of your application. More details on the Wiki.
IC
Documentation : I want more
Do not hesitate to check unit tests on the solution. It's a good way to check how transformations are tested.
Also, to get more samples, go to the Wiki.
Do not hesitate to contribute.
Support / Contribute
If you have any questions, problems or suggestions, create an issue or fork the project and create a Pull Request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
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 |
---|---|---|
1.2.0 | 1,130 | 11/10/2022 |
1.2.0-preview-58 | 145 | 11/9/2022 |
1.2.0-preview-57 | 118 | 10/25/2022 |
1.2.0-preview-56 | 101 | 10/24/2022 |
1.2.0-preview-55 | 134 | 10/19/2022 |
1.1.0 | 502 | 1/25/2022 |