Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seagreen/Son
Work in progress. Best alternative: https://matrix.org/docs/spec/appendices.html#canonical-json
https://github.com/seagreen/Son
Last synced: about 1 month ago
JSON representation
Work in progress. Best alternative: https://matrix.org/docs/spec/appendices.html#canonical-json
- Host: GitHub
- URL: https://github.com/seagreen/Son
- Owner: seagreen
- Created: 2017-01-31T21:34:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-23T18:56:29.000Z (almost 5 years ago)
- Last Synced: 2024-11-07T17:02:26.242Z (about 1 month ago)
- Language: Haskell
- Homepage:
- Size: 220 KB
- Stars: 358
- Watchers: 12
- Forks: 7
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Son
A subset of JSON.
JSON contains redundant syntax such as allowing both `10e2` and `10E2`. This helps when writing it by hand but isn't good for machine-to-machine communication. Piping JSON through multiple programs creates lots of trivial changes, which makes it hard to do things like take meaningful diffs.
Son is a subset of JSON without redundant options. It's intended for machine-to-machine communication by programs that want to follow [Postel's Law](https://tools.ietf.org/html/rfc761#section-2.10) -- they can accept normal JSON for flexibility and output Son for consistency.
## Son Numbers
![Number](./diagrams/png/number.png)
+ No exponential notation
+ No trailing zeros in fractions
+ No negative zero
+ No positive sign### positiveInteger:
![Positive Integer](./diagrams/png/positiveInteger.png)
### fraction:
![Fraction](./diagrams/png/fraction.png)
## Son Strings
![String](./diagrams/png/string.png)
+ No unnecessary escape sequences
JSON doesn't allow Unicode characters below codepoint x20 or unescaped `"` and `\` in strings. To allow these to still be encoded in JSON we've had to keep a few escape sequences. We use two-character escape sequences (e.g. `\n`) when available, and six-character ones (e.g. `\u0001`) when not.
### shortcutEscape:
![shortcutEscape](./diagrams/png/shortcutEscape.png)
## Other Changes from JSON
+ No insignificant whitespace
# Status
Unreleased. Like JSON, the intention is that once Son is released it will never change.
# Specification
The formal part of its specification is [./son.ebnf](./son.ebnf). It uses the EBNF notation described [here](https://www.w3.org/TR/2004/REC-xml11-20040204/#sec-notation).
Additionally:
+ The only valid byte encoding of Son is UTF-8. Byte order marks are forbidden.
+ Object keys must be unique.
+ Object members must be sorted by ascending lexicographic order of their keys.
# Implementations
+ Haskell reference implementation: [./implementation](./implementation).
# Special Thanks
+ [@chmike](https://github.com/chmike) and [@etherealvisage](https://github.com/etherealvisage): key ordering should specify "ascending".
+ [@John-Nagle](https://github.com/John-Nagle): UTF-8 should be the only allowed encoding.
# Differences between this and related projects
See [here](https://housejeffries.com/page/7).
# Notes
+ The diagrams were generated with [GrammKit](https://github.com/dundalek/GrammKit).
+ `./vendored/rfc7159.txt` is from [here](https://tools.ietf.org/rfc/rfc7159.txt).