Skip to content

Conversation

@Cybermaxke
Copy link
Member

@Cybermaxke Cybermaxke commented Jun 28, 2018

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)

Copy link
Contributor

@parlough parlough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't test at the moment, but the implementation seems good and appears to match the link you sent me(and now your summary on the post).

@Cybermaxke Cybermaxke self-assigned this Jun 29, 2018
@Cybermaxke Cybermaxke changed the base branch from master to 1.12 April 24, 2020 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants