json-0.3.3: Support for serialising Haskell to and from JSONContentsIndex
Text.JSON.Types
Portabilityportable
Stabilityprovisional
MaintainerDon Stewart <dons@galois.com>
Contents
JSON Types
Wrapper Types
Description
Synopsis
data JSValue
= JSNull
| JSBool !Bool
| JSRational !Rational
| JSString JSString
| JSArray [JSValue]
| JSObject (JSObject JSValue)
newtype JSString = JSONString {
fromJSString :: String
}
toJSString :: String -> JSString
fromJSString :: JSString -> String
newtype JSObject e = JSONObject {
fromJSObject :: [(String, e)]
}
toJSObject :: [(String, a)] -> JSObject a
fromJSObject :: JSObject e -> [(String, e)]
JSON Types
data JSValue

JSON values

The type to which we encode Haskell values. There's a set of primitives, and a couple of heterogenous collection types.

Objects:

An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name.

Arrays:

An array structure is represented as square brackets surrounding zero or more values (or elements). Elements are separated by commas.

Only valid JSON can be constructed this way

Constructors
JSNull
JSBool !Bool
JSRational !Rational
JSString JSString
JSArray [JSValue]
JSObject (JSObject JSValue)
show/hide Instances
Wrapper Types
newtype JSString
Strings can be represented a little more efficiently in JSON
Constructors
JSONString
fromJSString :: String
show/hide Instances
toJSString :: String -> JSString
Turn a Haskell string into a JSON string.
fromJSString :: JSString -> String
newtype JSObject e
As can association lists
Constructors
JSONObject
fromJSObject :: [(String, e)]
show/hide Instances
Eq e => Eq (JSObject e)
Ord e => Ord (JSObject e)
Read e => Read (JSObject e)
Show e => Show (JSObject e)
JSON a => JSON (JSObject a)
toJSObject :: [(String, a)] -> JSObject a
Make JSON object out of an association list.
fromJSObject :: JSObject e -> [(String, e)]
Produced by Haddock version 2.1.0