JSLTSharp 1.3.0-preview-070

This is a prerelease version of JSLTSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package JSLTSharp --version 1.3.0-preview-070                
NuGet\Install-Package JSLTSharp -Version 1.3.0-preview-070                
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.3.0-preview-070" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JSLTSharp --version 1.3.0-preview-070                
#r "nuget: JSLTSharp, 1.3.0-preview-070"                
#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.3.0-preview-070&prerelease

// Install JSLTSharp as a Cake Tool
#tool nuget:?package=JSLTSharp&version=1.3.0-preview-070&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

  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.

You want more ? Feel free to create an issue or contribute by adding new functionnalities by forking the project and create a pull request.

And if you like this project, don't forget to star it !

You can also support me with a coffee :

"Buy Me A Coffee"

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JSLTSharp:

Package Downloads
MDev.Dotnet.SemanticKernel.Connectors.AzureAIStudio.Gpto1

Connector for Azure AI Studio LLM model : gpt4 o1 and o1-mini

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 124 11/23/2024
1.3.0-preview-071 152 11/22/2024
1.3.0-preview-070 74 11/22/2024
1.2.0 1,145 11/10/2022
1.2.0-preview-58 148 11/9/2022
1.2.0-preview-57 121 10/25/2022
1.2.0-preview-56 104 10/24/2022
1.2.0-preview-55 137 10/19/2022
1.1.0 509 1/25/2022