blob: cc6327aed2518ce3f66d081137c14be637d6ab11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Json
( jsonObject
, jsonId
) where
import Data.Int (Int64)
import Data.Text (Text)
import qualified Data.Aeson.Types as Json
import qualified Data.HashMap.Strict as M
import Web.Scotty
jsonObject :: [(Text, Json.Value)] -> ActionM ()
jsonObject = json . Json.Object . M.fromList
jsonId :: Int64 -> ActionM ()
jsonId key = json . Json.Object . M.fromList $ [("id", Json.Number . fromIntegral $ key)]
|