json-0.4.3: Support for serialising Haskell to and from JSON

Portabilityportable
Stabilityprovisional
MaintainerSigbjorn Finne <sof@galois.com>

Text.JSON.String

Contents

Description

 

Synopsis

Parsing

data GetJSON a Source

Parsing JSON

The type of JSON parsers for String

runGetJSON :: GetJSON a -> String -> Either String aSource

Run a JSON reader on an input String, returning some Haskell value. All input will be consumed.

Reading JSON

readJSNull :: GetJSON JSValueSource

Read the JSON null type

readJSBool :: GetJSON JSValueSource

Read the JSON Bool type

readJSString :: GetJSON JSValueSource

Read the JSON String type

readJSRational :: GetJSON RationalSource

Read an Integer or Double in JSON format, returning a Rational

readJSArray :: GetJSON JSValueSource

Read a list in JSON format

readJSObject :: GetJSON JSValueSource

Read an object in JSON format

readJSValue :: GetJSON JSValueSource

Read one of several possible JS types

readJSTopType :: GetJSON JSValueSource

Top level JSON can only be Arrays or Objects

Writing JSON

showJSNull :: ShowSSource

Write the JSON null type

showJSBool :: Bool -> ShowSSource

Write the JSON Bool type

showJSArray :: [JSValue] -> ShowSSource

Show a list in JSON format

showJSObject :: JSObject JSValue -> ShowSSource

Show an association list in JSON format

showJSRational :: Rational -> ShowSSource

Show a Rational in JSON format

showJSValue :: JSValue -> ShowSSource

Show JSON values

showJSTopType :: JSValue -> ShowSSource

Writing JSON

Show strict JSON top level types. Values not permitted at the top level are wrapped in a singleton array.