JSLTSharp 1.3.0-preview-070
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
<PackageReference Include="JSLTSharp" Version="1.3.0-preview-070" />
paket add JSLTSharp --version 1.3.0-preview-070
#r "nuget: JSLTSharp, 1.3.0-preview-070"
// 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
- 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.
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 :
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.1)
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 |