A simple one class file to parse, modify, and export JSON.
A one class extension to SimpleJSON that allows parsing, modifying, and exporting of common Unity objects (Vector2
, Vector3
, Quaternion
, Rect
, Color
, etc.)
A one class extension to SimpleJSON that provides methods to serialize a JSON object tree into a compact binary format.
This forked version of Bunny83's SimpleJSON contains modifications that I've made for another project, ChroMapper. The changes are listed below.
- Added
JSONParseException
which SimpleJSON throws instead of a genericException
when callingJSON.Parse
orJSONNode.Parse
.- It includes
TokenLocation
, which is a string to the location where the parsing has failed- For example:
_customData._preciseSpeed
- For example:
- It also includes
ToUIFriendlyString()
, which I mainly use for outputting to the user when using ChroMapper.
- It includes
- SimpleJSON now throws a
JSONParseException
when a new node starts being parsed before an existing node is completed.- Works on both new lines and on a single line.
- For example, trying to parse
{ "_objectA": "someValue" "_objectB": "someOtherValue" }
will throw aJSONParseException
, whereas in the original SimpleJSON, the returned JSONNode will exclude_objectB
.
- Added support for Color in
SimpleJSONUnity
- Supports both Array format (
[r, g, b]
) and Object format ({ "r": r, "g": g, "b": b }
)- Alpha is optional, and defaults to 1. It is the 4th element in the Array format, and is named
a
in the Object format.
- Alpha is optional, and defaults to 1. It is the 4th element in the Array format, and is named
- Only saves in the container type defined in
JSONNode.ColorContainerType
- You can easily change
JSONNode.ColorContainerType
to switch between Array format and Object format.
- You can easily change
- Supports both Array format (