Maintainer | Leon P Smith <leon@melding-monads.com> |
---|
Data structure agnostic JSON serialization
Documentation
class Value a => Key a whereSource
The Key
typeclass represents types that are rendered
into json strings. They are special because only strings
can appear as field names of a json objects.
The Value
typeclass represents types that can be rendered
into valid json syntax.
Value Bool | |
Value Double | |
Value Float | |
Value Int | |
Value Int8 | |
Value Int16 | |
Value Int32 | |
Value Int64 | |
Value Integer | |
Value Word | |
Value Word8 | |
Value Word16 | |
Value Word32 | |
Value Word64 | |
Value () | |
Value Text | |
Value Text | |
Value ByteString | |
Value ByteString | |
Value Array | |
Value Object | |
Value Escaped | |
Value [Char] | |
Value a => Value [a] | |
(Key k, Value a) => Value (Map k a) |
The Object
type represents a builder that constructs syntax for a
json object. It has a singleton constructor row
, and an instance of
monoid, so that arbitrary objects can be constructed. Note that
duplicate field names will appear in the output, so it is up to the
user of this interface to avoid duplicate field names.
The Escaped
type is a special Builder value that represents a UTF-8
encoded string with all necessary characters json-escaped. These builders
must not render the opening or closing quotes, which are instead rendered
by toBuilder
. This is so that Json strings can be efficiently constructed
from multiple Haskell strings without actually concatinating the Haskell
strings (which might require some kind of conversion in addition to
concatination.)