Lantern icon indicating copy to clipboard operation
Lantern copied to clipboard

Mojangson

Open Cybermaxke opened this issue 7 years ago • 0 comments

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: b or B1b or 1B
    • short: s or S1s or 1S
    • int: <just integer>, i or I1, 1i or 1I (i and I support = custom)
    • long: l or L1l or 1L
    • float: f or F1f, 1.0f or 1F
    • double: <just floating point number>, d or D1.0, 1d, 1.0d or 1D
  • 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 char data type, use ` as prefix and optionally suffix, e.g. `A` (custom)

Cybermaxke avatar Jun 28 '18 14:06 Cybermaxke