JSLTSharp 1.2.0

dotnet add package JSLTSharp --version 1.2.0
NuGet\Install-Package JSLTSharp -Version 1.2.0
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="JSLTSharp" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JSLTSharp --version 1.2.0
#r "nuget: JSLTSharp, 1.2.0"
#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 JSLTSharp as a Cake Addin
#addin nuget:?package=JSLTSharp&version=1.2.0

// Install JSLTSharp as a Cake Tool
#tool nuget:?package=JSLTSharp&version=1.2.0

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

  1. Add nuget package:

Install-Package JSLTSharp

  1. 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

Quality Gate Status .NET NuGet package

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 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. 
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
1.2.0 991 11/10/2022
1.2.0-preview-58 122 11/9/2022
1.2.0-preview-57 104 10/25/2022
1.2.0-preview-56 88 10/24/2022
1.2.0-preview-55 121 10/19/2022
1.1.0 478 1/25/2022