Lantern
Lantern copied to clipboard
Mojangson
This PR implements the Mojangson data format.
- Parses valid JSON
- Allows trailing
,character at the end of a compound/array, e.g.[1,2,3,],{{"key": "value",},} - Allows keys/values without quotes if they only contain the chars
a-zA-Z0-9.-_+ - Numbers are suffixed with their value type:
-
byte:borB→1bor1B -
short:sorS→1sor1S -
int:<just integer>,iorI→1,1ior1I(iandIsupport = custom) -
long:lorL→1lor1L -
float:forF→1f,1.0for1F -
double:<just floating point number>,dorD→1.0,1d,1.0dor1D
-
- Lists can be prefixed to be deserialized as a array, instead of list:
-
byte[]:B;→[B; 1, 2, 3] -
short[]:S;→[S; 1, 2, 3](custom) -
int[]:I;→[I; 1, 2, 3] -
long[]:L;→[L; 1, 2, 3,] -
float[]:F;→[F; 1, 2.44, 3.2](custom) -
double[]:D;→[D; 1, 2.44, 3.2](custom)
-
- Allow single quotes to be used instead of double quotes for strings, double quotes don't need to be escaped while using single quotes. (custom)
- Allow characters to be parsed as
chardata type, use`as prefix and optionally suffix, e.g.`A`(custom)