Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ExternalMethods/ExternalMethods.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows8.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion JUST.net/JUST.net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Title>JUST - JSON Under Simple Transformation</Title>
<TargetFrameworks>net6.0-windows8.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>This a cool .NET Standard library which enables you to transform a JSON document into another JSON document using JSON transformations using JSON path. This is the JSON equivalent of XSLT.
This will repace the JUST and JUST.NETCore packages.</Description>
<Summary>This is the JSON equivalent of XSLT</Summary>
Expand Down
2 changes: 1 addition & 1 deletion JUST.net/Properties/PublishProfiles/FolderProfile.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<TargetFramework>netstandard1.6</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<PublishDir>bin\Release\PublishOutput</PublishDir>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions JUST.net/Transformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,11 @@ public static object tointeger(object val, JUSTContext context)
return ReflectionHelper.GetTypedValue(typeof(int), val, context.EvaluationMode);
}

public static object tolong(object val, JUSTContext context)
{
return ReflectionHelper.GetTypedValue(typeof(long), val, context.EvaluationMode);
}

public static object tostring(object val, JUSTContext context)
{
return ReflectionHelper.GetTypedValue(typeof(string), val, context.EvaluationMode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down
2 changes: 1 addition & 1 deletion UnitTests/JUST.net.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

Expand Down
17 changes: 17 additions & 0 deletions UnitTests/TypeConversionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ public void ToIntegerConvertion(string typedValue, string expectedResult)
Assert.AreEqual($"{{\"result\":{expectedResult}}}", result);
}

[TestCase("\"12345678901\"", "12345678901")]
[TestCase("\"-12345678901\"", "-12345678901")]
[TestCase("\"0\"", "0")]
[TestCase("12345678901.23", "12345678901")]
[TestCase("-12345678901.56", "-12345678902")]
[TestCase("true", "1")]
[TestCase("false", "0")]
public void ToLongConversion(string typedValue, string expectedResult)
{
var input = $"{{ \"value\": {typedValue} }}";
const string transformer = "{ \"result\": \"#tolong(#valueof($.value))\" }";

var result = new JsonTransformer().Transform(transformer, input);

Assert.AreEqual($"{{\"result\":{expectedResult}}}", result);
}

[TestCase("\"0\"", "0.0")]
[TestCase("\"1.01\"", "1.01")]
[TestCase("123", "123.0")]
Expand Down