27 Mar
2009
27 Mar
'09
12:04 a.m.
Peter Verswyvelen <bugfact <at> gmail.com> writes:
Well, for JSON, I think the rendered string must be enclosed in double quotes, which is what the show instance for String does.
Ahh. I see. My version yields this output: main = let x = JString "hello" y = JNumber 10 rx = renderJValue x ry = renderJValue y in putStrLn ("[" ++ rx ++ ", " ++ ry ++ "]") $ simple [hello, 10.0] ...and that is not correct JSON format. hello looks like a variable name--not a string. The books version produces: ["hello", 10.0] which is what a javascript array that contains a string looks like. Thanks.