data-object-json-0.3.1.2: Serialize JSON data to/from Haskell using the data-object library.

Data.Object.Json

Contents

Description

A simple wrapper around the json-b library which presents values inside Objects.

Synopsis

Definition of JsonObject

data JsonScalar Source

Matches the scalar data types used in json-b so we can have proper mapping between the two libraries.

type JsonObject = Object ByteString JsonScalarSource

Meant to match closely with the JSON data type. Therefore, uses strict byte strings for keys and the JsonScalar type for scalars.

Automatic scalar conversions

Encoding/decoding

encode :: (ConvertSuccess k ByteString, IsJsonScalar v) => Object k v -> ByteStringSource

Encode a JsonObject into a lazy bytestring.

decode :: Failure JsonDecodeError m => ConvertSuccess ByteString k => IsJsonScalar v => ByteString -> m (Object k v)Source

Decode a lazy bytestring into a JsonObject.

Exception type

data JsonDecodeError Source

Error type for JSON decoding errors.