Go from Card God blog unity on both Android and iOS JSON libraries
Although JSON parsing is common, it is often seen that you discuss how to parse it. But a lot of people often have problems. This article will help you solve the problem of JSON parsing at once.
This article uses JSON parsing in real-world projects and is compatible with PC, Android, and iOS. There is nothing to say, a C # write parsing JSON of the tool class, in unity can parse normally.
A less useful JSON parsing library:
Litjson is unstable on iOS, sometimes normal, and sometimes not normal.
Minijson is said to support incomplete, not tested.
The JSON parsing given in this article can work correctly on iOS and Android.
Note: Modify 1
If your target. NET version is less than 3.0 or WP7, you need to add "#define Simple_json_no_linq_expression" to the head of the file, Unity remembers, because Unity uses. NET 2.0 (or its subset).
Note: Modify 2
The value returned by the ToString () of Jsonnode is enclosed in double quotes if you sometimes need: float. Parse (data["Key"). ToString ()) makes an error when the string is transferred to a number.
So you can modify the ToString method of Jsonnode and remove the double quotation marks.
Usage:
Simplejson.jsonnode data = SimpleJson.JSON.Parse ("{\" key\ ": \" Value\ "}");
data["Key"]. The value of ToString () is: "Value"
GitHub original version Download:
Https://github.com/facebook-csharp-sdk/simple-json
"Go" on unity compatible with both Android and iOS JSON libraries