1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
------------------------------------------------------------------------------
--- This library contains the definition of a data type to represent
--- JSON values.
---
--- @author Jonas Oberschweiber
--- @version May 2017
------------------------------------------------------------------------------

module JSON.Data (JValue (..)) where

--- A JSON value.
---
--- @cons JTrue - true
--- @cons JFalse - false
--- @cons JNull - null, i.e. a missing value
--- @cons JString - a JSON string
--- @cons JNumber - a JSON number (numbers are always floats in JSON)
--- @cons JArray - a JSON array, represented by a list of JValues
--- @cons JObject - a JSON object, represented by a map from Strings to JValues
data JValue = JTrue
            | JFalse
            | JNull
            | JString String
            | JNumber Float
            | JArray [JValue]
            | JObject [(String, JValue)]
 deriving (Eq,Show)