Introduce first version of Quick JSON - Unity plugin for working with JSON.
1)DESCRIPTION:
Best JSON Serializer/Deserializer on UNITY. Two times faster as the Newtonsoft(NETJson).
Based on FastJson.
Android, iOS, Windows Phone, Windows, Mac OS, Linux
2)FEATURES:
- faster JSON Serializer/Deserializer on UNITY;
- based on FastJSON;
- JSON Framework for comfort working with JSON;
- 2 method for compress/decompress JSON: LZMA and QZIP
- Support UTF8 fields of JSON
- Full source code
- Multiplatform plugin: Android, iOS, Windows Phone, Windows, Mac OS, Linux
3)METHODS:
JSONObject:
- (void) Deserialise(string JSONString):
deserialize JSON
-(T) TryGetValue():
try get value from JSONObject with Generic type.
-
(string) ToString():
return string of this JObject -
(string) ToJSON(object obj):
return JSON string from object - serialize object
JSONCompress:
- (byte) CompressJSON(string JSON, bool best = true):
Compress JSON string to a)if best = true - LZMA
b)if best = false - QZIP - (string) DecompressJSON(byte sourceData, bool best = true):
Decompress byte data to string JSON from a) if best = true - LZMA
b) if best = false - QZIP
- EXAMPLES(HOW USAGE):
COMPRESS/DECOMPRESS:
string JSON = "{ \ "name\ ": \ "Вася\ ", \ "age\ ": 35, \ "isAdmin\ ": false, \ "friends\ “: [0,1,2,3] }”;
byte compressed = JSONCompress.CompressJSON (JSON, true);
string decompressedString =JSONCompress.DecompressJSON(compressed, true);
//in compressed - compressed Data of JSON
//in decompressedString - decompressed source JSON
JSON Serializer/Deserializer:
JSONObject jObject = new JSONObject ();
//line - source JSON string
jObject.Deserialise (line);
JSONObject testObject = jObject[“boolean”][0];
string text = testObject.finishObj.ToString();
string name = jObject [“personages”] [“1”].TryGetValue ();
//show all keys in Dictonary
void showDic(JSONObject jObject) {
Dictionary<string, JSONObject> dic = jObject.dic;
foreach(string key in dic.Keys) {
Debug.Log (key);
if (dic [key].dic != null) {
showDic (dic [key]);
} else if (dic [key].list != null) {
showList (dic [key]);
} else {
Debug.Log (“value:” + dic[key].finishObj);
}
}
}
//show all keys in list
void showList(JSONObject jObject) {
List list = jObject.list;
foreach(JSONObject listNode in list) {
Debug.Log (listNode.finishObj);
}
}
5)CONTACTS:
All of your comments and suggestions please send on email:
tahionstudios@gmail.com
All right reserved by Tahion Studios