This library contains the definition of a data type to represent JSON values.
Author: Jonas Oberschweiber
Version: February 2025
fromJObject
:: JObject -> [(String,JValue)] Extracts the list of name / JSON value pairs from a JSON object. |
toJObject
:: [(String,JValue)] -> JObject Transforms a list of name / JSON value pairs into a JSON object. |
lookupName
:: String -> JObject -> Maybe JValue Retrieves the JSON value with a given name from a JSON object, if it exists. |
insertField
:: String -> JValue -> JObject -> JObject Inserts a name / JSON value pair in a JSON object. |
A JSON value.
Constructors:
JBool
:: Bool -> JValue
: a Boolean value (true
or false
in JSON)
JNull
:: JValue
: null, i.e. a missing value
JString
:: String -> JValue
: a JSON string
JInt
:: Int -> JValue
: a JSON number without decimal point and exponent
JNumber
:: Float -> JValue
: a JSON number (numbers are always floats in JSON)
JArray
:: [JValue] -> JValue
: a JSON array, represented by a list of JValues
JObject
:: JObject -> JValue
: a JSON object, represented by a map from Strings to JValues
Extracts the list of name / JSON value pairs from a JSON object.
|
Transforms a list of name / JSON value pairs into a JSON object. Pairs with duplicated names are deleted to ensure that the JSON object is a map from names to values. |
Retrieves the JSON value with a given name from a JSON object, if it exists. |
Inserts a name / JSON value pair in a JSON object. If the name already exists, the existing value is overwritten. |