Do not include .0 on integers in generated links
This commit is contained in:
+3
-1
@@ -16,6 +16,7 @@ import Data.HashMap.Strict (keys, elems, filterWithKey, toList)
|
|||||||
import Data.String.Conversions (cs)
|
import Data.String.Conversions (cs)
|
||||||
import Data.List (sortBy)
|
import Data.List (sortBy)
|
||||||
import Data.Functor.Identity
|
import Data.Functor.Identity
|
||||||
|
import Data.Scientific (isInteger, formatScientific, FPFormat(..))
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
|
|
||||||
import Network.HTTP.Types.Status
|
import Network.HTTP.Types.Status
|
||||||
@@ -226,7 +227,8 @@ handleJsonObj req handler = do
|
|||||||
|
|
||||||
unquoted :: Value -> Text
|
unquoted :: Value -> Text
|
||||||
unquoted (String t) = t
|
unquoted (String t) = t
|
||||||
unquoted (Number n) = cs . show $ n
|
unquoted (Number n) =
|
||||||
|
cs $ formatScientific Fixed (if isInteger n then Just 0 else Nothing) n
|
||||||
unquoted (Bool b) = cs . show $ b
|
unquoted (Bool b) = cs . show $ b
|
||||||
unquoted _ = ""
|
unquoted _ = ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user