A unidirectional value-based JSON codec library.
Whether this is more performant than other options is still being clarified. See the benchmarks.
See DESIGN.md for the reasoning behind this library's design. The rest of this section covers my goals and where I'm at in that process.
Address gripes with other JSON codec libraries:
simple-json
:- I don't want to have to fork or copy the repo to benefit from it / change various type class instances.
- I don't want to use your information-poor error type,
NonEmptyList ForeignError
argonaut-codec
/codec-argonaut
:- I don't want to use your "does not allow custom error messages" type,
JsonDecodeError
- Allow me to specify the order in which to encode something
- Allow me the ability to rename fields when encoding/decoding
- I don't want to use your "does not allow custom error messages" type,
Improve error messages:
- on type mismatch errors, show me what you expected AND got, not just what was expected
- allow me to write custom error messages
Provide record syntax that distinguishes between
- when decoding
- optional fields: whether a field is required or optional
- renaming: decoding a key "foo" but putting it in a record label "bar"
- when encoding
- order of fields: the order in which to encode fields
- renaming: encoding a record label "bar" but encoding it as "foo" in the JSON
- See snapshots
For an example of decoding text and encoding examples, see ./test/test-output.txt
codec
- Copyright (c) 2019 Gary Burgess (MIT)codec-argonaut
- Copyright (c) 2017 Gary Burgess (MIT)argonaut-codec
- Copyright (c) 2020 PureScript Contrib (MIT)