Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Basic support for working with JSON5 values.
Synopsis
- data GetJSON a
- runGetJSON :: GetJSON a -> String -> Either String a
- readJSNull :: GetJSON JSValue
- readJSBool :: GetJSON JSValue
- readJSString :: Char -> GetJSON JSValue
- readJSRational :: GetJSON Rational
- readJSInfNaN :: GetJSON Float
- readJSArray :: GetJSON JSValue
- readJSObject :: GetJSON JSValue
- readJSValue :: GetJSON JSValue
- readJSTopType :: GetJSON JSValue
- showJSNull :: ShowS
- showJSBool :: Bool -> ShowS
- showJSArray :: [JSValue] -> ShowS
- showJSObject :: JSObject JSValue -> ShowS
- showJSRational :: Rational -> ShowS
- showJSInfNaN :: Float -> ShowS
- showJSValue :: JSValue -> ShowS
- showJSTopType :: JSValue -> ShowS
Parsing
Parsing JSON5
The type of JSON5 parsers for String
runGetJSON :: GetJSON a -> String -> Either String a Source #
Run a JSON5 reader on an input String, returning some Haskell value. All input will be consumed.
Reading JSON5
readJSNull :: GetJSON JSValue Source #
Read the JSON5 null type
readJSBool :: GetJSON JSValue Source #
Read the JSON5 Bool type
readJSRational :: GetJSON Rational Source #
Numbers
Read an Integer or Double in JSON5 format, returning a Rational
readJSInfNaN :: GetJSON Float Source #
Read an Infinity or NaN in JSON5 format, returning a Float
readJSArray :: GetJSON JSValue Source #
Objects & Arrays
Read a list in JSON5 format
readJSObject :: GetJSON JSValue Source #
Read an object in JSON5 format
readJSValue :: GetJSON JSValue Source #
Read one of several possible JS types
readJSTopType :: GetJSON JSValue Source #
Top level JSON5 can only be Arrays or Objects
Writing JSON5
showJSNull :: ShowS Source #
Write the JSON5 null type
showJSBool :: Bool -> ShowS Source #
Write the JSON5 Bool type
showJSArray :: [JSValue] -> ShowS Source #
Show a list in JSON format
showJSRational :: Rational -> ShowS Source #
Show a Rational in JSON5 format
showJSInfNaN :: Float -> ShowS Source #
Show a Infinity or NaN in JSON5 format
showJSValue :: JSValue -> ShowS Source #
Show JSON5 values
showJSTopType :: JSValue -> ShowS Source #
Writing JSON5
Show strict JSON5 top level types. Values not permitted at the top level are wrapped in a singleton array.