16 Commits
1_1_1 ... 1_2_2

Author SHA1 Message Date
e3b086e4a4 1.2.2 2021-06-13 12:19:51 +02:00
43f19ac206 Fix Assembly Info generation 2021-06-13 12:18:54 +02:00
3fdcad0f8a Update README.md for new Nuget generation. 2021-06-13 06:07:39 +02:00
dc737187ee Migrate Nuget package generation to MSBuild project. 2021-06-13 06:05:01 +02:00
ff32ad9d1f Migrate to Sdk projects. Migrate tests from NUnit to xUnit. 2021-06-13 05:17:01 +02:00
a4153ded57 Convert tests to NUnit 2021-06-13 04:08:52 +02:00
e4a9cb1995 Update README.md and Copyright years. 2021-06-13 04:00:16 +02:00
4cec1c6a20 1.2.0. 2020-09-07 00:33:46 +02:00
76a8e350e6 JsonParser: Ignore errors converting to property type. 2020-09-07 00:33:08 +02:00
d3c6e34350 JsonParser: Casts arrays to better tailored lists, instead of List<object>. 2020-09-06 23:11:47 +02:00
8382f7f9ea Merge branch 'master' of https://github.com/Kableado/VAR.Json 2020-09-06 03:49:29 +02:00
5e6b51506e Update copyright to 2020. 2020-09-06 03:48:33 +02:00
79183c8b68 Convert old validity tests to a test project. 2020-09-06 03:48:17 +02:00
18f2fd0b7a Always try to write reflected object. 2020-09-06 03:46:32 +02:00
9d4c2c170d JsonParser: Ignore errors while trying to convert to types. 2020-09-06 03:45:31 +02:00
fb58fa8109 Fix serialization of DateTime. 2020-06-08 08:34:02 +02:00
51 changed files with 630 additions and 524 deletions

1
.gitignore vendored
View File

@@ -28,3 +28,4 @@ _ReSharper*/
*.userprefs
*.nupkg
/.vs/*
/packages/*

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2016-2017 Valeriano Alfonso Rodriguez
Copyright (c) 2016-2021 Valeriano Alfonso Rodriguez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -5,23 +5,43 @@
### VAR.Json
Add the resulting assembly as reference in your projects, and this line on code:
using VAR.Json;
```csharp
using VAR.Json;
```
Parse any string with JSON content:
var jsonParser = new JsonParser();
object result = jsonParser("{\"Test\": 1}");
```csharp
object result = JsonParser.ParseText("{\"Test\": 1}");
```
Serialize any object to JSON:
```csharp
string jsonText = JsonWriter.WriteObject(new List<int>{1, 2, 3, 4});
```
### VAR.Json.JsonParser
This object can be invoked with a list of types used to cast the json objects.
```csharp
class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public DateTime DateOfBirth { get; set; }
}
JsonParser jsonParser = new JsonParser();
jsonParser.KnownTypes.Add(typeof(Person));
Person jsonText = jsonParser.Parse("{ \"Name\": \"John", \"Surname\": \"Doe\", \"DateOfBirth\": \"1970-01-01\"}") as Person;
```
var jsonWriter = new JsonWriter();
string jsonText = jsonWriter(new List<int>{1, 2, 3, 4});
## Building
A Visual Studio 2015 solutions are provided. Simply, click build on the IDE.
A Visual Studio solution is provided. Simply, click build on the IDE.
A .nuget package can be build using:
VAR.Json\Build.NuGet.cmd
The build generates a DLL and a Nuget package.
## Contributing
1. Fork it!
@@ -37,7 +57,7 @@ A .nuget package can be build using:
The MIT License (MIT)
Copyright (c) 2016-2017 Valeriano Alfonso Rodriguez
Copyright (c) 2016-2021 Valeriano Alfonso Rodriguez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -0,0 +1,478 @@
using System.Collections.Generic;
using Xunit;
namespace VAR.Json.Tests
{
public class JsonParser_Tests
{
#region Parse
public class SwallowObject
{
public string Text { get; set; }
public int Number { get; set; }
}
[Fact]
public void Parse__SwallowObject()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
SwallowObject result = parser.Parse(@"{""Text"": ""AAAA"", ""Number"": 42}") as SwallowObject;
Assert.False(parser.Tainted);
Assert.Equal("AAAA", result.Text);
Assert.Equal(42, result.Number);
}
public class DeeperObject_L1
{
public string Name { get; set; }
public SwallowObject Object { get; set; }
}
[Fact]
public void Parse__DeeperObject_L1()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
parser.KnownTypes.Add(typeof(DeeperObject_L1));
DeeperObject_L1 result = parser.Parse(@"{""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}") as DeeperObject_L1;
Assert.False(parser.Tainted);
Assert.Equal("Thing", result.Name);
Assert.Equal("AAAA", result.Object.Text);
Assert.Equal(42, result.Object.Number);
}
public class DeeperObject_L2
{
public int Count { get; set; }
public DeeperObject_L1 Object { get; set; }
}
[Fact]
public void Parse__DeeperObject_L2()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
parser.KnownTypes.Add(typeof(DeeperObject_L1));
parser.KnownTypes.Add(typeof(DeeperObject_L2));
DeeperObject_L2 result = parser.Parse(@"{""Count"": 1, ""Object"": {""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}}") as DeeperObject_L2;
Assert.False(parser.Tainted);
Assert.Equal(1, result.Count);
Assert.Equal("Thing", result.Object.Name);
Assert.Equal("AAAA", result.Object.Object.Text);
Assert.Equal(42, result.Object.Object.Number);
}
[Fact]
public void Parse__SwallowObjectArray()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
List<SwallowObject> result = parser.Parse(@"[{""Text"": ""AAAA"", ""Number"": 42}]") as List<SwallowObject>;
Assert.False(parser.Tainted);
Assert.Single(result);
Assert.Equal("AAAA", result[0].Text);
Assert.Equal(42, result[0].Number);
}
public class DeeperObjectArray_L1
{
public int Count { get; set; }
public List<SwallowObject> Array { get; set; }
}
[Fact]
public void Parse__DeeperObjectArray_L1()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
DeeperObjectArray_L1 result = parser.Parse(@"{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}") as DeeperObjectArray_L1;
Assert.False(parser.Tainted);
Assert.Equal(1, result.Count);
Assert.Equal("AAAA", result.Array[0].Text);
Assert.Equal(42, result.Array[0].Number);
}
public class DeeperObjectArray_L2
{
public string Name { get; set; }
public List<DeeperObjectArray_L1> Objects { get; set; }
}
[Fact]
public void Parse__DeeperObjectArray_L2()
{
JsonParser parser = new JsonParser();
parser.KnownTypes.Add(typeof(SwallowObject));
parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
parser.KnownTypes.Add(typeof(DeeperObjectArray_L2));
DeeperObjectArray_L2 result = parser.Parse(@"{""Name"": ""Thing"", ""Objects"": [{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}]}") as DeeperObjectArray_L2;
Assert.False(parser.Tainted);
Assert.Equal("Thing", result.Name);
Assert.Equal(1, result.Objects[0].Count);
Assert.Equal("AAAA", result.Objects[0].Array[0].Text);
Assert.Equal(42, result.Objects[0].Array[0].Number);
}
#endregion Parse
#region Validity tests
[Fact]
public void Parse__Validity_Fail01()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"""A JSON payload should be an object or array, not a string.""");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail02()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Unclosed array""");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail03()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{unquoted_key: ""keys must be quoted""}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail04()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""extra comma"",]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail05()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""double extra comma"",,]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail06()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[ , ""<-- missing value""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail07()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Comma after the close""],");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail08()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Extra close""]]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail09()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Extra comma"": true,}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail10()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Extra value after close"": true} ""misplaced quoted value""");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail11()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Illegal expression"": 1 + 2}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail12()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Illegal invocation"": alert()}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail13()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Numbers cannot have leading zeroes"": 013}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail14()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Numbers cannot be hex"": 0x14}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail15()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Illegal backslash escape: \x15""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail16()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[\naked]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail17()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Illegal backslash escape: \017""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail18()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[[""Too deep""]]]]]]]]]]]]]]]]]]]]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail19()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Missing colon"" null}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail20()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Double colon"":: null}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail21()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Comma instead of colon"", null}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail22()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Colon instead of comma"": false]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail23()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""Bad value"", truth]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail24()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"['single quote']");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail25()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"["" tab character in string ""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail26()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""tab\ character\ in\ string\ ""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail27()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""line
break""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail28()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""line\
break""]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail29()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[0e]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail30()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[0e+]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail31()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[0e+-1]");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail32()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{""Comma instead if closing brace"": true,");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Fail33()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[""mismatch""}");
Assert.True(parser.Tainted);
}
[Fact]
public void Parse__Validity_Pass01()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[
""JSON Test Pattern pass1"",
{""object with 1 member"":[""array with 1 element""]},
{},
[],
-42,
true,
false,
null,
{
""integer"": 1234567890,
""real"": -9876.543210,
""e"": 0.123456789e-12,
""E"": 1.234567890E+34,
"""": 23456789012E66,
""zero"": 0,
""one"": 1,
""space"": "" "",
""quote"": ""\"""",
""backslash"": ""\\"",
""controls"": ""\b\f\n\r\t"",
""slash"": ""/ & \/"",
""alpha"": ""abcdefghijklmnopqrstuvwyz"",
""ALPHA"": ""ABCDEFGHIJKLMNOPQRSTUVWYZ"",
""digit"": ""0123456789"",
""0123456789"": ""digit"",
""special"": ""`1~!@#$%^&*()_+-={':[,]}|;.</>?"",
""hex"": ""\u0123\u4567\u89AB\uCDEF\uabcd\uef4A"",
""true"": true,
""false"": false,
""null"": null,
""array"":[ ],
""object"":{ },
""address"": ""50 St. James Street"",
""url"": ""http://www.JSON.org/"",
""comment"": ""// /* <!-- --"",
""# -- --> */"": "" "",
"" s p a c e d "" :[1,2 , 3
,
4 , 5 , 6 ,7 ],""compact"":[1,2,3,4,5,6,7],
""jsontext"": ""{\""object with 1 member\"":[\""array with 1 element\""]}"",
""quotes"": ""&#34; \u0022 %22 0x22 034 &#x22;"",
""\/\\\""\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?""
: ""A key can be any string""
},
0.5 ,98.6
,
99.44
,
1066,
1e1,
0.1e1,
1e-1,
1e00,2e+00,2e-00
,""rosebud""]");
Assert.False(parser.Tainted);
}
[Fact]
public void Parse__Validity_Pass02()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"[[[[[[[[[[[[[[[[[[[""Not too deep""]]]]]]]]]]]]]]]]]]]");
Assert.False(parser.Tainted);
}
[Fact]
public void Parse__Validity_Pass03()
{
JsonParser parser = new JsonParser();
object result = parser.Parse(@"{
""JSON Test Pattern pass3"": {
""The outermost value"": ""must be an object or array."",
""In this test"": ""It is an object.""
}
}
");
Assert.False(parser.Tainted);
}
#endregion Validity tests
}
}

View File

@@ -1,129 +0,0 @@
using System;
using System.IO;
using System.Text;
namespace VAR.Json.Tests
{
class Program
{
static void Main(string[] args)
{
// http://www.json.org/JSON_checker/
string currentPath = System.Reflection.Assembly.GetEntryAssembly().Location;
currentPath = FindPath(currentPath, "tests");
// Test all files
string[] files;
files = Directory.GetFiles(currentPath, "*.json");
foreach (string file in files)
{
TestFile(file);
}
Console.Read();
}
private static void TestFile(string fileName)
{
string testName = Path.GetFileNameWithoutExtension(fileName);
string fileContent = File.ReadAllText(fileName, Encoding.UTF8);
if (testName.StartsWith("fail"))
{
TestFailCase(testName, fileContent);
}
if (testName.StartsWith("pass"))
{
TestPassCase(testName, fileContent);
}
}
private static void TestFailCase(string testName, string fileContent)
{
JsonParser parser = new JsonParser();
object result;
try
{
result = parser.Parse(fileContent);
}
catch (Exception ex)
{
OutputFailure(testName, fileContent, ex);
return;
}
if (parser.Tainted == false)
{
OutputFailure(testName, fileContent, result);
return;
}
Console.Out.WriteLine("OK! {0}", testName);
}
private static void TestPassCase(string testName, string fileContent)
{
JsonParser parser = new JsonParser();
object result;
try
{
result = parser.Parse(fileContent);
}
catch (Exception ex)
{
OutputFailure(testName, fileContent, ex);
return;
}
if (parser.Tainted)
{
OutputFailure(testName, fileContent, result);
return;
}
Console.Out.WriteLine("OK! {0}", testName);
}
private static void OutputFailure(string testName, string fileContent, object obj)
{
Console.Out.WriteLine("Failure! {0}", testName);
Console.Out.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Console.Out.WriteLine("Content:\n{0}", fileContent);
Console.Out.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
if (obj is Exception)
{
Exception ex = obj as Exception;
Console.Out.WriteLine("Ex.Message: {0}", ex.Message);
Console.Out.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Console.Out.WriteLine("Ex.Stacktrace:\n{0}", ex.StackTrace);
Console.Out.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
if (obj != null && (obj is Exception) == false)
{
JsonWriter writter = new JsonWriter(new JsonWriterConfiguration(indent: true));
Console.Out.WriteLine("Parsed:\n{0}", writter.Write(obj));
Console.Out.WriteLine("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}
private static string FindPath(string currentPath, string directory)
{
do
{
string testPath = Path.Combine(currentPath, directory);
if (Directory.Exists(testPath))
{
currentPath = testPath;
Console.Out.WriteLine(testPath);
break;
}
else
{
DirectoryInfo dirInfo = Directory.GetParent(currentPath);
if (dirInfo == null)
{
throw new Exception(string.Format("FindPath: Directory {0} not found", directory));
}
currentPath = dirInfo.ToString();
}
} while (string.IsNullOrEmpty(currentPath) == false);
return currentPath;
}
}
}

View File

@@ -1,14 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("VAR.Json.Tests")]
[assembly: AssemblyDescription("Json Tests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VAR")]
[assembly: AssemblyProduct("VAR.Json.Tests")]
[assembly: AssemblyCopyright("Copyright © VAR 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("576297b8-423d-4533-b75a-f186ccff0d2a")]
[assembly: AssemblyVersion("1.0.*")]

View File

@@ -1,95 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{576297B8-423D-4533-B75A-F186CCFF0D2A}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VAR.Json.Tests</RootNamespace>
<AssemblyName>VAR.Json.Tests</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ProjectReference Include="..\VAR.Json\VAR.Json.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="tests\fail01.json" />
<None Include="tests\fail10.json" />
<None Include="tests\fail11.json" />
<None Include="tests\fail12.json" />
<None Include="tests\fail13.json" />
<None Include="tests\fail14.json" />
<None Include="tests\fail15.json" />
<None Include="tests\fail16.json" />
<None Include="tests\fail17.json" />
<None Include="tests\fail18.json" />
<None Include="tests\fail19.json" />
<None Include="tests\fail02.json" />
<None Include="tests\fail20.json" />
<None Include="tests\fail21.json" />
<None Include="tests\fail22.json" />
<None Include="tests\fail23.json" />
<None Include="tests\fail24.json" />
<None Include="tests\fail25.json" />
<None Include="tests\fail26.json" />
<None Include="tests\fail27.json" />
<None Include="tests\fail28.json" />
<None Include="tests\fail29.json" />
<None Include="tests\fail03.json" />
<None Include="tests\fail30.json" />
<None Include="tests\fail31.json" />
<None Include="tests\fail32.json" />
<None Include="tests\fail33.json" />
<None Include="tests\fail04.json" />
<None Include="tests\fail05.json" />
<None Include="tests\fail06.json" />
<None Include="tests\fail07.json" />
<None Include="tests\fail08.json" />
<None Include="tests\fail09.json" />
<None Include="tests\pass01.json" />
<None Include="tests\pass02.json" />
<None Include="tests\pass03.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VAR.Json\VAR.Json.csproj">
<Project>{28b3f937-145c-4fd4-a75b-a25ea4cc0428}</Project>
<Name>VAR.Json</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1 +0,0 @@
"A JSON payload should be an object or array, not a string."

View File

@@ -1 +0,0 @@
["Unclosed array"

View File

@@ -1 +0,0 @@
{unquoted_key: "keys must be quoted"}

View File

@@ -1 +0,0 @@
["extra comma",]

View File

@@ -1 +0,0 @@
["double extra comma",,]

View File

@@ -1 +0,0 @@
[ , "<-- missing value"]

View File

@@ -1 +0,0 @@
["Comma after the close"],

View File

@@ -1 +0,0 @@
["Extra close"]]

View File

@@ -1 +0,0 @@
{"Extra comma": true,}

View File

@@ -1 +0,0 @@
{"Extra value after close": true} "misplaced quoted value"

View File

@@ -1 +0,0 @@
{"Illegal expression": 1 + 2}

View File

@@ -1 +0,0 @@
{"Illegal invocation": alert()}

View File

@@ -1 +0,0 @@
{"Numbers cannot have leading zeroes": 013}

View File

@@ -1 +0,0 @@
{"Numbers cannot be hex": 0x14}

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \x15"]

View File

@@ -1 +0,0 @@
[\naked]

View File

@@ -1 +0,0 @@
["Illegal backslash escape: \017"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]

View File

@@ -1 +0,0 @@
{"Missing colon" null}

View File

@@ -1 +0,0 @@
{"Double colon":: null}

View File

@@ -1 +0,0 @@
{"Comma instead of colon", null}

View File

@@ -1 +0,0 @@
["Colon instead of comma": false]

View File

@@ -1 +0,0 @@
["Bad value", truth]

View File

@@ -1 +0,0 @@
['single quote']

View File

@@ -1 +0,0 @@
[" tab character in string "]

View File

@@ -1 +0,0 @@
["tab\ character\ in\ string\ "]

View File

@@ -1,2 +0,0 @@
["line
break"]

View File

@@ -1,2 +0,0 @@
["line\
break"]

View File

@@ -1 +0,0 @@
[0e]

View File

@@ -1 +0,0 @@
[0e+]

View File

@@ -1 +0,0 @@
[0e+-1]

View File

@@ -1 +0,0 @@
{"Comma instead if closing brace": true,

View File

@@ -1 +0,0 @@
["mismatch"}

View File

@@ -1,58 +0,0 @@
[
"JSON Test Pattern pass1",
{"object with 1 member":["array with 1 element"]},
{},
[],
-42,
true,
false,
null,
{
"integer": 1234567890,
"real": -9876.543210,
"e": 0.123456789e-12,
"E": 1.234567890E+34,
"": 23456789012E66,
"zero": 0,
"one": 1,
"space": " ",
"quote": "\"",
"backslash": "\\",
"controls": "\b\f\n\r\t",
"slash": "/ & \/",
"alpha": "abcdefghijklmnopqrstuvwyz",
"ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
"digit": "0123456789",
"0123456789": "digit",
"special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
"hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
"true": true,
"false": false,
"null": null,
"array":[ ],
"object":{ },
"address": "50 St. James Street",
"url": "http://www.JSON.org/",
"comment": "// /* <!-- --",
"# -- --> */": " ",
" s p a c e d " :[1,2 , 3
,
4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
"jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
"quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
"\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
: "A key can be any string"
},
0.5 ,98.6
,
99.44
,
1066,
1e1,
0.1e1,
1e-1,
1e00,2e+00,2e-00
,"rosebud"]

View File

@@ -1 +0,0 @@
[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]

View File

@@ -1,6 +0,0 @@
{
"JSON Test Pattern pass3": {
"The outermost value": "must be an object or array.",
"In this test": "It is an object."
}
}

View File

@@ -1,11 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio Version 16
VisualStudioVersion = 16.0.30330.147
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Json", "VAR.Json\VAR.Json.csproj", "{28B3F937-145C-4FD4-A75B-A25EA4CC0428}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VAR.Json.Tests", "VAR.Json.Tests\VAR.Json.Tests.csproj", "{576297B8-423D-4533-B75A-F186CCFF0D2A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json", "VAR.Json\VAR.Json.csproj", "{28B3F937-145C-4FD4-A75B-A25EA4CC0428}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421-5348-48F1-8B67-A4D43E616FDE}"
ProjectSection(SolutionItems) = preProject
@@ -13,22 +11,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json.Tests", "VAR.Json.Tests\VAR.Json.Tests.csproj", "{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.ActiveCfg = Debug .Net 4.6.1|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.Build.0 = Debug .Net 4.6.1|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.ActiveCfg = Release .Net 4.6.1|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.Build.0 = Release .Net 4.6.1|Any CPU
{576297B8-423D-4533-B75A-F186CCFF0D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{576297B8-423D-4533-B75A-F186CCFF0D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{576297B8-423D-4533-B75A-F186CCFF0D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{576297B8-423D-4533-B75A-F186CCFF0D2A}.Release|Any CPU.Build.0 = Release|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.Build.0 = Release|Any CPU
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9700B54-1919-4B81-B123-D4D3DE74124A}
EndGlobalSection
EndGlobal

View File

@@ -1,24 +0,0 @@
@echo off
:: MSBuild and tools path
if exist "%ProgramFiles%\MSBuild\14.0\bin" set PATH=%ProgramFiles%\MSBuild\14.0\bin;%PATH%
if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin" set PATH=%ProgramFiles(x86)%\MSBuild\14.0\bin;%PATH%
:: NuGet
set nuget="nuget"
if exist "%~dp0..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe" set nuget="%~dp0\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe"
:: Release .Net 3.5
Title Building Release .Net 3.5
msbuild VAR.Json.csproj /t:Build /p:Configuration="Release .Net 3.5" /p:Platform="AnyCPU"
:: Release .Net 4.6.1
Title Building Release .Net 4.6.1
msbuild VAR.Json.csproj /t:Build /p:Configuration="Release .Net 4.6.1" /p:Platform="AnyCPU"
:: Packing Nuget
Title Packing Nuget
%nuget% pack VAR.Json.csproj -Verbosity detailed -OutputDir "NuGet" -MSBuildVersion "14.0" -Properties Configuration="Release .Net 4.6.1" -Prop Platform=AnyCPU
title Finished
pause

View File

@@ -92,7 +92,14 @@ namespace VAR.Json
}
else
{
valueDest = Convert.ChangeType(obj[prop.Name], effectiveType);
try
{
valueDest = Convert.ChangeType(obj[prop.Name], effectiveType);
}
catch (Exception)
{
continue;
}
}
prop.SetValue(newObj, valueDest, null);
}
@@ -115,7 +122,12 @@ namespace VAR.Json
}
if (bestMatch != null)
{
return ConvertToType(obj, bestMatch);
try
{
object newObj = ConvertToType(obj, bestMatch);
return newObj;
}
catch (Exception) { } /* Nom Nom */
}
return obj;
}
@@ -416,7 +428,7 @@ namespace VAR.Json
}
}
private List<object> ParseArray(int recursiveCount = 1)
private object ParseArray(int recursiveCount = 1)
{
// StrictRules: Mark as tainted when MaxRecursiveCount is exceeded
if (recursiveCount >= MaxRecursiveCount) { _tainted = true; }
@@ -424,6 +436,9 @@ namespace VAR.Json
bool correct = false;
char c = _ctx.SkipWhite();
List<object> array = new List<object>();
Type arrayContentType = null;
bool hasSameType = true;
bool hasNulls = false;
if (c == '[')
{
_ctx.Next();
@@ -452,19 +467,44 @@ namespace VAR.Json
{
// StrictRules: Mark as tainted when unexpected value on array
if (expectValue == false) { _tainted = true; }
array.Add(ParseValue(recursiveCount + 1));
object value = ParseValue(recursiveCount + 1);
array.Add(value);
expectValue = false;
if (hasSameType)
{
Type valueType = value?.GetType();
if (valueType == null) { hasNulls = true; }
if (arrayContentType == null || arrayContentType == valueType)
{
arrayContentType = valueType;
}
else
{
hasSameType = false;
}
}
}
} while (!_ctx.AtEnd());
if (correct == false)
{
_tainted = true;
}
return array;
object result = array;
bool isNullableType = arrayContentType?.IsClass == true;
if (hasSameType && arrayContentType != null && (isNullableType == true || (isNullableType == false && hasNulls == false)))
{
var enumerableType = typeof(System.Linq.Enumerable);
var castMethod = enumerableType.GetMethod("Cast").MakeGenericMethod(arrayContentType);
var toListMethod = enumerableType.GetMethod("ToList").MakeGenericMethod(arrayContentType);
IEnumerable<object> itemsToCast = array;
var castedItems = castMethod.Invoke(null, new[] { itemsToCast });
result = toListMethod.Invoke(null, new[] { castedItems });
}
return result;
}
private Dictionary<string, object> ParseObject(int recursiveCount = 1)
private object ParseObject(int recursiveCount = 1)
{
// StrictRules: Mark as tainted when MaxRecursiveCount is exceeded
if (recursiveCount >= MaxRecursiveCount) { _tainted = true; }
@@ -533,7 +573,8 @@ namespace VAR.Json
{
_tainted = true;
}
return obj;
object result = TryConvertToTypes(obj);
return result;
}
private object ParseValue(int recusiveCount = 1)
@@ -553,8 +594,7 @@ namespace VAR.Json
break;
case '{':
Dictionary<string, object> obj = ParseObject(recusiveCount);
token = TryConvertToTypes(obj);
token = ParseObject(recusiveCount);
break;
case '[':

View File

@@ -141,7 +141,7 @@ namespace VAR.Json
textWriter.Write('"');
}
private void WriteValue(TextWriter textWriter, object obj, List<object> parentLevels, bool useReflection)
private void WriteValue(TextWriter textWriter, object obj, List<object> parentLevels)
{
if (obj == null || obj is DBNull)
{
@@ -173,7 +173,7 @@ namespace VAR.Json
{
// DateTime
textWriter.Write('"');
textWriter.Write(((DateTime)obj).ToString("yyyy-MM-ddTHH:mm:ssZ"));
textWriter.Write(((DateTime)obj).ToString("yyyy-MM-ddTHH:mm:ss"));
textWriter.Write('"');
}
else if (obj is IDictionary)
@@ -188,15 +188,8 @@ namespace VAR.Json
}
else
{
if (useReflection)
{
// Reflected object
WriteReflectedObject(textWriter, obj, parentLevels);
}
else
{
WriteString(textWriter, Convert.ToString(obj));
}
// Reflected object
WriteReflectedObject(textWriter, obj, parentLevels);
}
}
@@ -242,7 +235,7 @@ namespace VAR.Json
}
first = false;
parentLevels.Add(obj);
WriteValue(textWriter, childObj, parentLevels, true);
WriteValue(textWriter, childObj, parentLevels);
parentLevels.Remove(obj);
}
if (!isLeaf || n > _config.IndentThresold)
@@ -297,7 +290,7 @@ namespace VAR.Json
WriteString(textWriter, Convert.ToString(key));
textWriter.Write(": ");
parentLevels.Add(obj);
WriteValue(textWriter, value, parentLevels, true);
WriteValue(textWriter, value, parentLevels);
parentLevels.Remove(obj);
}
if (!isLeaf || n > _config.IndentThresold)
@@ -369,11 +362,11 @@ namespace VAR.Json
parentLevels.Add(obj);
if (value != obj && parentLevels.Contains(value) == false)
{
WriteValue(textWriter, value, parentLevels, false);
WriteValue(textWriter, value, parentLevels);
}
else
{
WriteValue(textWriter, null, parentLevels, false);
WriteValue(textWriter, null, parentLevels);
}
parentLevels.Remove(obj);
}
@@ -394,14 +387,14 @@ namespace VAR.Json
{
textWriter = new StringWriter();
}
WriteValue(textWriter, obj, new List<object>(), true);
WriteValue(textWriter, obj, new List<object>());
return textWriter;
}
public string Write(object obj)
{
StringWriter textWriter = new StringWriter();
WriteValue(textWriter, obj, new List<object>(), true);
WriteValue(textWriter, obj, new List<object>());
return textWriter.ToString();
}

View File

@@ -1,14 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("VAR.Json")]
[assembly: AssemblyDescription(".Net library for JSON parsing")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("VAR")]
[assembly: AssemblyProduct("VAR.Json")]
[assembly: AssemblyCopyright("Copyright © VAR 2016-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("28b3f937-145c-4fd4-a75b-a25ea4cc0428")]
[assembly: AssemblyVersion("1.1.1.*")]

View File

@@ -1,84 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{28B3F937-145C-4FD4-A75B-A25EA4CC0428}</ProjectGuid>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VAR.Json</RootNamespace>
<AssemblyName>VAR.Json</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<IsPackable>true</IsPackable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 4.6.1|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\net461</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 4.6.1|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net461</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug .Net 3.5|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\net35</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<LangVersion>6</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release .Net 3.5|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net35</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<LangVersion>6</LangVersion>
<PropertyGroup>
<PackageId>VAR.Json</PackageId>
<Title>VAR.Json</Title>
<Version>1.2.2</Version>
<Description>.Net library for JSON parsing</Description>
<Authors>VAR</Authors>
<Company>VAR</Company>
<Copyright>Copyright © VAR 2016-2021</Copyright>
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageProjectUrl>https://github.com/Kableado/VAR.Json</PackageProjectUrl>
<PackageTags>JSON;JSON Library</PackageTags>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Content Include="..\LICENSE.txt" Link="LICENSE.txt" Pack="true" PackagePath=""/>
</ItemGroup>
<ItemGroup>
<Compile Include="JsonParser.cs" />
<Compile Include="JsonWriter.cs" />
<Compile Include="ObjectActivator.cs" />
<Compile Include="ParserContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Build.NuGet.cmd" />
<None Include="packages.config" />
<None Include="VAR.Json.nuspec" />
</ItemGroup>
<ItemGroup>
<None Include="Nuget\keep.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
<Target Name="CopyPackage" AfterTargets="Pack">
<Copy
SourceFiles="$(OutputPath)..\$(PackageId).$(PackageVersion).nupkg"
DestinationFolder="Nuget\"
/>
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<licenseUrl>https://github.com/Kableado/VAR.Json/blob/master/LICENSE.txt</licenseUrl>
<projectUrl>https://github.com/Kableado/VAR.Json</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<copyright>Copyright VAR 2016-2017</copyright>
<tags>JSON Library</tags>
</metadata>
<files>
<file src="bin\Release\net461\VAR.Json.dll" target="lib\net461\VAR.Json.dll" />
<file src="bin\Release\net461\VAR.Json.pdb" target="lib\net461\VAR.Json.pdb" />
<file src="bin\Release\net35\VAR.Json.dll" target="lib\net35\VAR.Json.dll" />
<file src="bin\Release\net35\VAR.Json.pdb" target="lib\net35\VAR.Json.pdb" />
</files>
</package>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NuGet.CommandLine" version="3.4.3" targetFramework="net461" developmentDependency="true" />
</packages>