JD2022-TU1/main/phone_apps/JDCompanionApp/Assets/Scripts/Vendors/light-json
2026-10-05 12:05:45 +03:00
..
JSON.cs А это уже второй коммит (сам проект) 2026-10-05 12:05:45 +03:00
JSON.cs.meta А это уже второй коммит (сам проект) 2026-10-05 12:05:45 +03:00
README.md А это уже второй коммит (сам проект) 2026-10-05 12:05:45 +03:00
README.md.meta А это уже второй коммит (сам проект) 2026-10-05 12:05:45 +03:00

LightJSON

LightJSON is a lightweight and optimized JSON parser written in C# for use in Unity games.

Conformance

LightJSON implements the ECMA-404 standard as closely as possible.

However, here are the (small) deviations from the full specification:

  • Escaping characters with \u is not supported in strings
  • Number parsing is not strictly as per the spec, but instead relies on System.Convert.ToDouble(). The implementation is very close to the spec, and supports exponents properly (e.g. 12.5e4)

Getting Started

The basic use case of parsing a JSON string is achieved through an API very similar to Javascript:

using LightJSON;
var json = JSON.Parse("{\"test\": 42}");

The resulting object is of class LightJSON.JSON, and can be used to extract or manipulate the parsed data:

// testValue will get 42.0
double testValue = json.GetField("test").NumberValue;

json.SetField("test", "hello");

To convert back to a string form, use the Stringify() method:

var str = JSON.Stringify(json);

License

MIT?