{-|
Module      : Data.Jdh.Json
Description : A module for small Json Value Types
License     : MIT
Maintainer  : brunoczim@gmail.com
Stability   : experimental
Portability : OS-Independent

This module contains the small version for Json Values. Example: A JSInt is implemented as Int.
Although the module is destinated for small values (Int, Float and String), all functions from Data.Json.Generic are avaible as generics. This module defines a type synonymous and two functions for encoding and decoding JSValue of this type.
-}
module Data.Jdh.Json(
    module G,
    Json,
    encode,
    decode
) where
import Data.Jdh.Json.Generic as G

-- | A synonymous type for (JSValue Int Float String)
type Json = JSValue Int Float String

-- | A function for encoding that specifies the types of JSValue to be the same as Json type. If the first argument is passed as false, the resulting string is condensed, otherwise, it will contain whitespaces as indentation and line breaks.
encode :: Bool -> Json -> String
encode True = G.prettify
encode False = G.stringify

-- | A function for decoding that specifies the types of JSValue to be the same as Json type.
decode :: String -> [(Json, String)]
decode = G.parse