"Go" on unity compatible with both Android and iOS JSON libraries

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.