![]() |
VOOZH | about |
dotnet add package Black.Beard.Jslt --version 1.0.374
NuGet\Install-Package Black.Beard.Jslt -Version 1.0.374
<PackageReference Include="Black.Beard.Jslt" Version="1.0.374" />
<PackageVersion Include="Black.Beard.Jslt" Version="1.0.374" />Directory.Packages.props
<PackageReference Include="Black.Beard.Jslt" />Project file
paket add Black.Beard.Jslt --version 1.0.374
#r "nuget: Black.Beard.Jslt, 1.0.374"
#:package Black.Beard.Jslt@1.0.374
#addin nuget:?package=Black.Beard.Jslt&version=1.0.374Install as a Cake Addin
#tool nuget:?package=Black.Beard.Jslt&version=1.0.374Install as a Cake Tool
Implementation of jslt language in DOTNET. Use a template for transform Json document to another json document.
The following sample for help you to easy start.
using Bb;
using Bb.Jslt.Services;
using System.Text;
public static class TemplateHelper
{
/// <summary>
/// Call this method for load anc compile template
/// </summary>
/// <param name="file">file that content the template jslt</param>
/// <param name="withDebug">if true, activate the debug mode</param>
/// <param name="paths">that for auto detect extended services</param>
/// <param name="services">add extended services</param>
/// <returns></returns>
public static JsltTemplate LoadTemplate(this FileInfo file, bool withDebug, string[] paths, params Type[] services)
{
var content = file.FullName.LoadFile();
StringBuilder sb = new StringBuilder();
var _template = sb.GetTransformProvider(withDebug, file.FullName, paths, services);
return _template;
}
public static JsltTemplate GetTransformProvider(this StringBuilder sb, bool withDebug, string templatefilename, string[] paths, params Type[] services)
{
var provider = GetProvider(paths, services);
JsltTemplate template = provider.GetTemplate(sb, withDebug, templatefilename);
return template;
}
public static TemplateTransformProvider GetProvider(string[] paths, params Type[] services)
{
var configuration = new TranformJsonAstConfiguration();
// If you haven't added Package "Black.Beard.Jslt.Services" you must comment this line.
// configuration.Assemblies.Add(typeof(Bb.Jslt.Services.Services).Assembly);
if (paths != null)
foreach (var item in paths)
if (!string.IsNullOrEmpty(item))
configuration.Paths.Add(item);
foreach (var item in services)
configuration.Services.ServiceDiscovery.AddService(item);
TemplateTransformProvider Templateprovider = new TemplateTransformProvider(configuration);
return Templateprovider;
}
}
Now a sample for use template
var file = new FileInfo(rulePayload);
file.Refresh();
if (!file.Exists)
throw new Exception($"the path '{file}' can't be resolved.");
// Build template
var _template = file.LoadTemplate(false, new string[0]);
// create an instance of sources with no datas
var src = Sources.GetEmpty();
// inject data in the model, for accessing by json path '$"
// var src2 = new Sources(SourceJson.GetFromText("{}"));
// Add a value for for accessing from the template
src.Variables.Add("My value", new JValue(1));
// execute template but not apply output directives.
var ctx = _template.Transform(src);
// execute template and apply output directives.
var result = _template.TransformForOutput(src);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on Black.Beard.Jslt:
| Package | Downloads |
|---|---|
|
Black.Beard.Jslt.Services
support extended method(loading excel, html, multicsv, sql). |
|
|
Black.Beard.Jslt.Symbol
Implementation of jslt language in DOTNET. Use a template for transform Json document to another json document. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.374 | 346 | 12/7/2024 |
| 1.0.373 | 276 | 12/7/2024 |
| 1.0.372 | 272 | 11/20/2024 |
| 1.0.371 | 258 | 11/20/2024 |
| 1.0.370 | 260 | 11/16/2024 |
| 1.0.369 | 262 | 11/16/2024 |
| 1.0.368 | 253 | 11/14/2024 |
| 1.0.367 | 250 | 11/14/2024 |
| 1.0.366 | 282 | 11/13/2024 |
| 1.0.365 | 262 | 11/13/2024 |
| 1.0.364 | 274 | 11/12/2024 |
| 1.0.363 | 287 | 11/12/2024 |
| 1.0.362 | 253 | 11/11/2024 |
| 1.0.361 | 249 | 11/11/2024 |
| 1.0.360 | 257 | 11/11/2024 |
| 1.0.359 | 267 | 11/11/2024 |
| 1.0.358 | 284 | 11/11/2024 |
| 1.0.357 | 267 | 11/11/2024 |
| 1.0.356 | 282 | 11/10/2024 |
| 1.0.355 | 265 | 11/10/2024 |