KissJSON 1.0.7

dotnet add package KissJSON --version 1.0.7                
NuGet\Install-Package KissJSON -Version 1.0.7                
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="KissJSON" Version="1.0.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KissJSON --version 1.0.7                
#r "nuget: KissJSON, 1.0.7"                
#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 KissJSON as a Cake Addin
#addin nuget:?package=KissJSON&version=1.0.7

// Install KissJSON as a Cake Tool
#tool nuget:?package=KissJSON&version=1.0.7                

Introduction

This is a most simple and stupid JSON. It part of C#Like and C#LikeFree that I uploaded to the Unity Asset Store. You can get the C#LikeFree from GitHub too.

  • Compared with other JSON libraries, what's special?

Fully compatible with C#Like and can be used in hot update scripts.
JSONData and built-in types are seamlessly converted and used directly as built-in types,e.g. math operation.
Easy conversion between JSON string and JSONData and class/struct.


这个是最简单易用JSON. 它是我上传到Unity资源商店里的C#LikeC#Like免费版 的一部分. 你也可以在GitHub里下载到C#Like免费版.

  • 跟其他的JSON库比,有什么特别过人之处?

完全兼容C#Like,可在热更脚本里使用
JSONData与内置类型无缝互转,直接当做内置类型使用,例如数值计算
JSON字符串与JSONData与类/结构体之间轻松转换

Install

Package had been uploaded to Nuget, dependent library: .NET Standard 2.0. You can install by command Install-Package KissJSON


包已上传至Nuget,依赖库为: .NET Standard 2.0. 你可以通过Install-Package KissJSON来安装.

Usage

  • Built-in type that can direct convert with JSONData
	Built-in type: string sbyte ushort uint ulong byte short int long bool float double DateTime
	Built-in type nullable: sbyte? ushort? uint? ulong? byte? short? int? long? bool? float? double? DateTime?
	Enum  
	List<Built-in type>
	Dictionary<string,Built-in type>
  • JSONData and built-in types are seamlessly converted and used directly as built-in types,e.g. math operation
  • Built-in type →JSONData
	JSONData iData = 2;
	Console.WriteLine("JSONData iData = 2;  test iData = " + iData);//output 2
	JSONData fData = 88.8f;
	Console.WriteLine("JSONData fData = 88.8f;  test fData = " + fData);//output 88.8
	List<string> listValue = new List<string>();
	listValue.Add("test list str1");
	listValue.Add("test list str2");
	JSONData listData = listValue;
	Console.WriteLine("JSONData listData = listValue;  test listData = " + listData);//output ["test list str1","test list str2"]
	Dictionary<string, int> dictValue = new Dictionary<string, int>();
	dictValue.Add("key1", 11);
	dictValue.Add("key2", 22);
	JSONData dictData = dictValue;
	Console.WriteLine("JSONData dictData = dictValue;  test dictData = " + dictData);//output {"key1":11,"key2":22}
  • JSONData → Built-in type
	int iValue = iData;
	Console.WriteLine("int iValue = iData;  test iValue = " + iValue);//output 2
	float fValue = fData;
	Console.WriteLine("float fValue = fData;  test fValue = " + fValue);//output 88.8
	List<string> listValue2 = listData;
	string strTemp = "";
	foreach (var str in listValue2)
	    strTemp += str + ",";
	Console.WriteLine("List<string> listValue2 = listData;  test listValue2 = " + strTemp);//output test list str1,test list str2,
	Dictionary<string, int> dictValue2 = dictData;
	strTemp = "";
	foreach (var item in dictValue2)
	    strTemp += "(" + item.Key + "=" + item.Value + ")";
	Console.WriteLine("Dictionary<string, int> dictValue2 = dictData;  test dictValue2 = " + strTemp);//output (key1=11)(key2=22)
  • Math operation between JSONData and Built-in type.
	JSONData exprData1 = 2;
	JSONData exprData2 = 3;
	JSONData exprData3 = exprData1 * exprData2;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 * exprData2; exprData3 = " + exprData3);//output 6
	exprData3 = exprData1 << 5;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 << 5; exprData3 = " + exprData3);//output 64
	exprData3 = exprData1 - exprData2;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 - exprData2; exprData3 = " + exprData3);//output -1
	exprData3 *= exprData2;//exprData3=-1;exprData2=3
	Console.WriteLine("test Math Expression;  exprData3 *= exprData2; exprData3 = " + exprData3);//output -3

	iData = 2;
	if (iData > 1)
	    Console.WriteLine("test Math Expression;  iData = 2, enter if (iData > 1)");//output
	else
	    Console.WriteLine("test Math Expression;  iData = 2, not enter if (iData > 1)");
  • Easy conversion between JSON string and JSONData and class/struct*
  • JSON string → JSONData
	string strJson = @"{
  "str": "{test \"str", 
  "i": 11, 
  "j": 2.3, 
  "k": [
    3, 
    null, 
    {
      "m": true
    }
  ], 
  "l": {
    "x": 1, 
    "y": "abc"
  }
}";
	JSONData data = KissJson.ToJSONData(strJson);
	//accept JSONData by ["key"] and [index]
	Console.WriteLine("JSON string => JSONData; test data[\"str\"] = " + data["str"]);//output {test "str
	Console.WriteLine("JSON string => JSONData; test data[\"i\"] = " + data["i"]);//output 11
	Console.WriteLine("JSON string => JSONData; test data[\"j\"] = " + data["j"]);//output 2.3
	Console.WriteLine("JSON string => JSONData; test data[\"k\"] = " + data["k"]);//output [3,null,{"m":true}]
	Console.WriteLine("JSON string => JSONData; test data[\"l\"] = " + data["l"]);//output {"x":1,"y":"abc"}
	Console.WriteLine("JSON string => JSONData; test data[\"k\"][0] = " + data["k"][0]);//output 3
	Console.WriteLine("JSON string => JSONData; test data[\"l\"][\"y\"] = " + data["l"]["y"]);//output abc
	Console.WriteLine("JSON string => JSONData; test data[\"k\"][2][\"m\"] = " + data["k"][2]["m"]);//output true
  • JSONData → JSON string
	JSONData listData3 = JSONData.NewDictionary();
	listData3.Add("key1", 10);         //add data like Dictionary use function 'Add(key,value)'
	listData3["key2"] = "test string"; //add data like Dictionary use index set 'this[]'
	listData3["key3"] = JSONData.NewList(); //we add a list
	if (listData3.ContainsKey("key3"))  //make sure the key 'key3' exist if you don't know whether exist
	    listData3["key3"].Add(1);       //add some data to the list
	listData3["key3"].Insert(0,"string2"); //insert some data to the list,we don't check the key 'key3' exist because we just know it exist!
	listData3["key4"] = JSONData.NewDictionary(); //we add a Dictionary
	listData3["key4"]["x"] = 1;
	listData3["key4"]["y"] = 2;
	listData3["key4"]["z"] = 3;
	Debug.Log("test JSONData => JSON string; strJson = " + listData3.ToJson());//output {"key1":10,"key2":"test string","key3":["string2",1],"key4":{"x":1,"y":2,"z":3}}
  • The demo class/struct that using in convert with JSON string and JSONData
	/// <summary>
	/// test class <=> JSON
	/// </summary>
	public class TestJsonDataSub
	{
	    public int? id;//test nullable
	    public string name;
	    public Vector2 v2;//you can add other class/struct type,such as Color/Rect/Vector3/...
	    public List<string> info;
	    public Dictionary<string, int> maps;
	}
	//mark the class as KissJsonDontSerialize, will ignore while serialize JSON
	[KissJsonDontSerialize]
	public class TestJsonDataSub2
	{
	    public int id;
	}
	/// <summary>
	/// test class <=> JSON
	/// </summary>
	public class TestJsonData
	{
	    [KissJsonDontSerialize]
	    public string str;//will ignore while serialize JSON because be mark as KissJsonDontSerialize
	    public int i;
	    public DayOfWeek j;//test enum of not hot update
	    public TestHotUpdateEnum z;//test enum of hot update
	    public List<int?> k;
	    public Dictionary<string, TestJsonDataSub> datas;//test Dictionary for class/struct
	    public TestJsonDataSub data;//test single class/struct
	    public TestJsonDataSub2 data2;//will ignore while serialize JSON because the class 'TestJsonDataSub2' mark as KissJsonDontSerialize
	}
	/// <summary>
	/// test convert hot update enum
	/// </summary>
	public enum TestHotUpdateEnum
	{
	    Morning,
	    Afternoon,
	    Evening
	}  
	/// <summary>
	/// test struct
	/// </summary>
	public struct Vector2
	{
	    public float x;
	    public float y;
	    public override string ToString()
	    {
	        return $"({x:F2},{y:F2})";
	    }
	}
  • JSON string → class/struct
	strJson = "{\"str\":\"{test str\",\"i\":11,\"j\":1,\"z\":2,\"k\":[3,null,7],\"datas\":{\"aa\":{\"id\":1,\"name\":\"aaa\",\"v2\":{\"x\":1,\"y\":2},\"info\":[\"a\",\"xd\",\"dt\"],\"maps\":{\"x\":1,\"y\":2}},\"bb\":{\"id\":2,\"name\":\"bbb\",\"v2\":{\"x\":3,\"y\":4},\"info\":[\"x\",\"x3d\",\"ddt\"],\"maps\":{\"x\":2,\"y\":3}}},\"data\":{\"id\":3,\"name\":\"ccc\",\"v2\":{\"x\":3,\"y\":1},\"info\":[\"ya\",\"xyd\",\"drt\"],\"maps\":{\"x\":3,\"y\":4}}}";
	TestJsonData testJsonData = (TestJsonData)KissJson.ToObject(typeof(TestJsonData), strJson);//JSON string => class
	////test JSONData => class/struct
	//TestJsonData testJsonData = (TestJsonData)KissJson.ToObject(typeof(TestJsonData), KissJson.ToJSONData(strJson));//JSONData => class
	Console.WriteLine(testJsonData.str);//output Null
	Console.WriteLine(testJsonData.i);//output 11
	//"j":"Monday" or "j":"1" or "j":1 are both identified as 'DayOfWeek.Monday'
	//recommend use "j":1 because ToJson output as number
	Console.WriteLine(testJsonData.j);//output Monday
	Console.WriteLine((int)testJsonData.j);//output 1
	Console.WriteLine(testJsonData.z);//output 2
	foreach (var item in testJsonData.k)
	    Console.WriteLine(item);//output 3/output null/output 7
	foreach (var datas in testJsonData.datas)
	{
	    Console.WriteLine(datas.Key);//output aa/output bb
	    Console.WriteLine(datas.Value.v2);//output (1.0, 2.0)/output (3.0, 4.0)
	}
  • class/struct → JSON string
	strTemp = KissJson.ToJson(testJsonData);//class/struct => JSON string
	Console.WriteLine(strTemp);//output {"i":11,"j":1,"z":2,"k":[3,null,7],"datas":{"aa":{"id":1,"name":"aaa","v2":{"x":1,"y":2},"info":["a","xd","dt"],"maps":{"x":1,"y":2}},"bb":{"id":2,"name":"bbb","v2":{"x":3,"y":4},"info":["x","x3d","ddt"],"maps":{"x":2,"y":3}}},"data":{"id":3,"name":"ccc","v2":{"x":3,"y":1},"info":["ya","xyd","drt"],"maps":{"x":3,"y":4}}}
  • class/struct → JSONData
	data = KissJson.ToJSONData(testJsonData);
  • Format JSON string
	Console.WriteLine(data.ToJson(true));//Formatting JSON strings for better readability
	Console.WriteLine(data.ToJson());//Not formatting JSON strings, poor readability, but JSON strings are short, more suitable for transmission

Formatting JSON string:
{
    "i": 11,
    "j": 1,
    "z": 2,
    "k": [
        3,
        null,
        7
    ],
    "datas": {
        "aa": {
            "id": 1,
            "name": "aaa",
            "v2": {
                "x": 1,
                "y": 2
            },
            "info": [
                "a",
                "xd",
                "dt"
            ],
            "maps": {
                "x": 1,
                "y": 2
            }
        },
        "bb": {
            "id": 2,
            "name": "bbb",
            "v2": {
                "x": 3,
                "y": 4
            },
            "info": [
                "x",
                "x3d",
                "ddt"
            ],
            "maps": {
                "x": 2,
                "y": 3
            }
        }
    },
    "data": {
        "id": 3,
        "name": "ccc",
        "v2": {
            "x": 3,
            "y": 1
        },
        "info": [
            "ya",
            "xyd",
            "drt"
        ],
        "maps": {
            "x": 3,
            "y": 4
        }
    }
}
Not formatting JSON string:
{"i":11,"j":1,"z":2,"k":[3,null,7],"datas":{"aa":{"id":1,"name":"aaa","v2":{"x":1,"y":2},"info":["a","xd","dt"],"maps":{"x":1,"y":2}},"bb":{"id":2,"name":"bbb","v2":{"x":3,"y":4},"info":["x","x3d","ddt"],"maps":{"x":2,"y":3}}},"data":{"id":3,"name":"ccc","v2":{"x":3,"y":1},"info":["ya","xyd","drt"],"maps":{"x":3,"y":4}}}

  • Deep clone JSONData object
	JSONData clone = JSONData.DeepClone(data);//Deep clone JSONData, 'clone' object is not the same object with 'data'.
	JSONData notClone = data;  //Just set value, 'notClone' is alias of the 'data', they are the same object.
	data["i"] = 100;//Modify the 'data' object, that will not effect the 'clone' object.
	Console.WriteLine(clone.ToJson());
	Console.WriteLine(notClone.ToJson());

  • 可与JSONData之间互转的内置类型
	内置类型: string sbyte ushort uint ulong byte short int long bool float double DateTime
	可空内置类型: sbyte? ushort? uint? ulong? byte? short? int? long? bool? float? double? DateTime?
	枚举  
	List<内置类型>
	Dictionary<string,内置类型>
  • JSONData与内置类型无缝互转,直接当做内置类型使用,例如数值计算
  • 内置类型 →JSONData
	JSONData iData = 2;
	Console.WriteLine("JSONData iData = 2;  test iData = " + iData);//输出 2
	JSONData fData = 88.8f;
	Console.WriteLine("JSONData fData = 88.8f;  test fData = " + fData);//输出 88.8
	List<string> listValue = new List<string>();
	listValue.Add("test list str1");
	listValue.Add("test list str2");
	JSONData listData = listValue;
	Console.WriteLine("JSONData listData = listValue;  test listData = " + listData);//输出 ["test list str1","test list str2"]
	Dictionary<string, int> dictValue = new Dictionary<string, int>();
	dictValue.Add("key1", 11);
	dictValue.Add("key2", 22);
	JSONData dictData = dictValue;
	Console.WriteLine("JSONData dictData = dictValue;  test dictData = " + dictData);//输出 {"key1":11,"key2":22}
  • JSONData → 内置类型
	int iValue = iData;
	Console.WriteLine("int iValue = iData;  test iValue = " + iValue);//输出 2
	float fValue = fData;
	Console.WriteLine("float fValue = fData;  test fValue = " + fValue);//输出 88.8
	List<string> listValue2 = listData;
	string strTemp = "";
	foreach (var str in listValue2)
	    strTemp += str + ",";
	Console.WriteLine("List<string> listValue2 = listData;  test listValue2 = " + strTemp);//输出 test list str1,test list str2,
	Dictionary<string, int> dictValue2 = dictData;
	strTemp = "";
	foreach (var item in dictValue2)
	    strTemp += "(" + item.Key + "=" + item.Value + ")";
	Console.WriteLine("Dictionary<string, int> dictValue2 = dictData;  test dictValue2 = " + strTemp);//输出 (key1=11)(key2=22)
  • JSONData 与 内置类型 之间数值运算
	JSONData exprData1 = 2;
	JSONData exprData2 = 3;
	JSONData exprData3 = exprData1 * exprData2;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 * exprData2; exprData3 = " + exprData3);//输出 6
	exprData3 = exprData1 << 5;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 << 5; exprData3 = " + exprData3);//输出 64
	exprData3 = exprData1 - exprData2;
	Console.WriteLine("test Math Expression;  exprData3 = exprData1 - exprData2; exprData3 = " + exprData3);//输出 -1
	exprData3 *= exprData2;//exprData3=-1;exprData2=3
	Console.WriteLine("test Math Expression;  exprData3 *= exprData2; exprData3 = " + exprData3);//输出 -3

	iData = 2;
	if (iData > 1)
	    Console.WriteLine("test Math Expression;  iData = 2, enter if (iData > 1)");//进入这里
	else
	    Console.WriteLine("test Math Expression;  iData = 2, not enter if (iData > 1)");
  • JSON字符串与JSONData与类之间轻松转换
  • JSON字符串 → JSONData
	string strJson = @"{
  "str": "{test \"str", 
  "i": 11, 
  "j": 2.3, 
  "k": [
    3, 
    null, 
    {
      "m": true
    }
  ], 
  "l": {
    "x": 1, 
    "y": "abc"
  }
}";
	JSONData data = KissJson.ToJSONData(strJson);
	//accept JSONData by ["key"] and [index]
	Console.WriteLine("JSON string => JSONData; test data[\"str\"] = " + data["str"]);//输出 {test "str
	Console.WriteLine("JSON string => JSONData; test data[\"i\"] = " + data["i"]);//输出 11
	Console.WriteLine("JSON string => JSONData; test data[\"j\"] = " + data["j"]);//输出 2.3
	Console.WriteLine("JSON string => JSONData; test data[\"k\"] = " + data["k"]);//输出 [3,null,{"m":true}]
	Console.WriteLine("JSON string => JSONData; test data[\"l\"] = " + data["l"]);//输出 {"x":1,"y":"abc"}
	Console.WriteLine("JSON string => JSONData; test data[\"k\"][0] = " + data["k"][0]);//输出 3
	Console.WriteLine("JSON string => JSONData; test data[\"l\"][\"y\"] = " + data["l"]["y"]);//输出 abc
	Console.WriteLine("JSON string => JSONData; test data[\"k\"][2][\"m\"] = " + data["k"][2]["m"]);//输出 true
  • JSONData → JSON字符串
	JSONData listData3 = JSONData.NewDictionary();
	listData3.Add("key1", 10);         //类似Dictionary的函数'Add(key,value)'的方式加数据
	listData3["key2"] = "test string"; //类似Dictionary/List索引'this[]'的方式加数据
	listData3["key3"] = JSONData.NewList(); //我们加一个List类型的JSONData
	if (listData3.ContainsKey("key3"))  //确保'key3'是否存在,如果你不确认的情况下
	    listData3["key3"].Add(1);       //插入一些数据到list里
	listData3["key3"].Insert(0,"string2"); //插入一些数据到list里, 我们这里不检查'key3'是否存在,因为我们已经确认它是存在的
	listData3["key4"] = JSONData.NewDictionary(); //我们加一个Dictionary类型的JSONData
	listData3["key4"]["x"] = 1;
	listData3["key4"]["y"] = 2;
	listData3["key4"]["z"] = 3;
	Debug.Log("test JSONData => JSON string; strJson = " + listData3.ToJson());//输出 {"key1":10,"key2":"test string","key3":["string2",1],"key4":{"x":1,"y":2,"z":3}}
  • 与JSON字符串/JSONData互转相关的类/结构体
	/// <summary>
	/// 测试 类 <=> JSON字符串
	/// </summary>
	public class TestJsonDataSub
	{
	    public int? id;//测试可空类型
	    public string name;
	    public Vector2 v2;//你可以添加其他类型,例如Color/Rect/Vector3/...
	    public List<string> info;
	    public Dictionary<string, int> maps;
	}
	//类被标为KissJsonDontSerialize的类会被JSON解析器忽略
	[KissJsonDontSerialize]
	public class TestJsonDataSub2
	{
	    public int id;
	}
	/// <summary>
	/// 测试 类 <=> JSON字符串
	/// </summary>
	public class TestJsonData
	{
	    [KissJsonDontSerialize]
	    public string str;//被标为KissJsonDontSerialize的属性会被JSON解析器忽略
	    public int i;
	    public DayOfWeek j;//测试枚举(非热更脚本)
	    public TestHotUpdateEnum z;//测试枚举(热更脚本)
	    public List<int?> k;
	    public Dictionary<string, TestJsonDataSub> datas;//测试Dictionary
	    public TestJsonDataSub data;//测试单个的类中类
	    public TestJsonDataSub2 data2;//这个会被JSON解析器忽略,因为TestJsonDataSub2这个类被标为KissJsonDontSerialize
	}
	/// <summary>
	/// 测试枚举
	/// </summary>
	public enum TestHotUpdateEnum
	{
	    Morning,
	    Afternoon,
	    Evening
	}  
	/// <summary>
	/// 测试结构体
	/// </summary>
	public struct Vector2
	{
	    public float x;
	    public float y;
	    public override string ToString()
	    {
	        return $"({x:F2},{y:F2})";
	    }
	}
  • JSON字符串 → 类/结构体
	strJson = "{\"str\":\"{test str\",\"i\":11,\"j\":1,\"z\":2,\"k\":[3,null,7],\"datas\":{\"aa\":{\"id\":1,\"name\":\"aaa\",\"v2\":{\"x\":1,\"y\":2},\"info\":[\"a\",\"xd\",\"dt\"],\"maps\":{\"x\":1,\"y\":2}},\"bb\":{\"id\":2,\"name\":\"bbb\",\"v2\":{\"x\":3,\"y\":4},\"info\":[\"x\",\"x3d\",\"ddt\"],\"maps\":{\"x\":2,\"y\":3}}},\"data\":{\"id\":3,\"name\":\"ccc\",\"v2\":{\"x\":3,\"y\":1},\"info\":[\"ya\",\"xyd\",\"drt\"],\"maps\":{\"x\":3,\"y\":4}}}";
	TestJsonData testJsonData = (TestJsonData)KissJson.ToObject(typeof(TestJsonData), strJson);//JSON 字符串 => 类
	////测试 JSONData => 类
	//TestJsonData testJsonData = (TestJsonData)KissJson.ToObject(typeof(TestJsonData), KissJson.ToJSONData(strJson));//JSONData => 类
	Console.WriteLine(testJsonData.str);//输出 Null
	Console.WriteLine(testJsonData.i);//输出 11
	//"j":"Monday"和"j":"1"和"j":1都会识别为'DayOfWeek.Monday'
	//推荐使用"j":1,因为ToJson()会输出为"j":1
	Console.WriteLine(testJsonData.j);//输出 Monday
	Console.WriteLine((int)testJsonData.j);//输出 1
	Console.WriteLine(testJsonData.z);//输出 2
	foreach (var item in testJsonData.k)
	    Console.WriteLine(item);//输出 3/输出 null/输出 7
	foreach (var datas in testJsonData.datas)
	{
	    Console.WriteLine(datas.Key);//输出 aa/输出 bb
	    Console.WriteLine(datas.Value.v2);//输出 (1.0, 2.0)/输出 (3.0, 4.0)
	}
  • 类/结构体 → JSON字符串
	strTemp = KissJson.ToJson(testJsonData);//类/结构体 => JSON字符串
	Console.WriteLine(strTemp);//输出 {"i":11,"j":1,"z":2,"k":[3,null,7],"datas":{"aa":{"id":1,"name":"aaa","v2":{"x":1,"y":2},"info":["a","xd","dt"],"maps":{"x":1,"y":2}},"bb":{"id":2,"name":"bbb","v2":{"x":3,"y":4},"info":["x","x3d","ddt"],"maps":{"x":2,"y":3}}},"data":{"id":3,"name":"ccc","v2":{"x":3,"y":1},"info":["ya","xyd","drt"],"maps":{"x":3,"y":4}}}
  • 类/结构体 → JSONData
	data = KissJson.ToJSONData(testJsonData);
  • 格式化JSON字符串
	Console.WriteLine(data.ToJson(true));//格式化JSON字符串,更好的可读性
	Console.WriteLine(data.ToJson());//不格式化JSON字符串,可读性差但JSON字符串很短,更适合传输

格式化JSON字符串为:
{
    "i": 11,
    "j": 1,
    "z": 2,
    "k": [
        3,
        null,
        7
    ],
    "datas": {
        "aa": {
            "id": 1,
            "name": "aaa",
            "v2": {
                "x": 1,
                "y": 2
            },
            "info": [
                "a",
                "xd",
                "dt"
            ],
            "maps": {
                "x": 1,
                "y": 2
            }
        },
        "bb": {
            "id": 2,
            "name": "bbb",
            "v2": {
                "x": 3,
                "y": 4
            },
            "info": [
                "x",
                "x3d",
                "ddt"
            ],
            "maps": {
                "x": 2,
                "y": 3
            }
        }
    },
    "data": {
        "id": 3,
        "name": "ccc",
        "v2": {
            "x": 3,
            "y": 1
        },
        "info": [
            "ya",
            "xyd",
            "drt"
        ],
        "maps": {
            "x": 3,
            "y": 4
        }
    }
}
不格式化JSON字符串:
{"i":11,"j":1,"z":2,"k":[3,null,7],"datas":{"aa":{"id":1,"name":"aaa","v2":{"x":1,"y":2},"info":["a","xd","dt"],"maps":{"x":1,"y":2}},"bb":{"id":2,"name":"bbb","v2":{"x":3,"y":4},"info":["x","x3d","ddt"],"maps":{"x":2,"y":3}}},"data":{"id":3,"name":"ccc","v2":{"x":3,"y":1},"info":["ya","xyd","drt"],"maps":{"x":3,"y":4}}}

  • 深复制JSONData
	JSONData clone = JSONData.DeepClone(data);//深复制JSONData对象, 'clone'和'data'是两个独立的对象.
	JSONData notClone = data;  //仅仅是复制,相当于'notClone'是'data'的别名,它们是同一个对象.
	data["i"] = 100;//修改'data'对象,不会影响到'clone'对象的数值.
	Console.WriteLine(clone.ToJson());
	Console.WriteLine(notClone.ToJson());
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KissJSON:

Package Downloads
KissFramework

This is a most simple and stupid server framework commponent include WebSocket/Socket/HTTP/MySQL, base on rule of 'Keep It Simple,Stupid'. All your logic work in A single main thread, you don't need to worry about multi-threading problem. All the heavy work process by framework in background threads. Easy to use database even never hear about SQL. You won't use the SQL knowledge, just need define the struct of database table, and then can use that data and it will automatically synchronize data with client and database. 这是一个最简洁易用的IOCP服务器框架,包含WebSocket/Socket/HTTP/MySQL,基于'Keep It Simple,Stupid'设计原则.用户逻辑单线程,后台数据库多线程,面向对象,操作极简,包含WebSocket/Socket/HTTP/MySQL,你不会用到SQL的,只需定义数据库表结构,即可使用数据且自动和客户端和数据库三者间同步数据.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 646 4/19/2023
1.0.6 194 4/19/2023
1.0.5 312 4/3/2023
1.0.4 213 4/2/2023
1.0.3 443 2/10/2023
1.0.2 742 2/1/2023
1.0.0 1,010 9/11/2022