blob: eb5c57292290522cb62f729a90d11d2c8dfd3333 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module Json
( jsonObject
, jsonId
) where
import qualified Data.Aeson.Types as Json
import qualified Data.HashMap.Strict as M
import Data.Int (Int64)
import Data.Text (Text)
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)]
|