Copyright | (c) Marien Matser Gerard van Schie Jelle Teeuwissen 2022 |
---|---|
License | MIT |
Maintainer | jelleteeuwissen@hotmail.nl |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Documentation
Json is a collection of possible Json values.
A rule can be any kind of Json value, but objects and arrays will be evaluated.
prettyShow :: Json -> String Source #
A pretty formatted show for the Json, with identation and depth Use putStr so the newline characters will be interpreted in console
>>>
putStr $ prettyShow JsonNull
null
>>>
putStr $ prettyShow $ JsonNumber 3.0
3.0
>>>
prettyShow (JsonArray [JsonNumber 1, JsonNumber 2])
"[\n 1.0,\n 2.0\n]"
>>>
putStr $ prettyShow (JsonArray [JsonNumber 1, JsonBool True])
[ 1.0, true ]
stringify :: Json -> String Source #
Convert Json to string, used in string operations See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString for more information.
isTruthy :: Json -> Bool Source #
Truthy test for Json See https://developer.mozilla.org/en-US/docs/Glossary/Truthy for more information.
parseFloat :: Json -> Double Source #
Convert Json to a numeric value, including NaN Same as the Parsefloat function in JS Parsefloat source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat NaN source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN