I usually write my own ToJSON
and FromJSON
instances, but I decided to use deriveJSON
for a type because it was so simple:
data Priority = HIGH | MEDIUM | LOW deriving Show
$(deriveToJSON id ''Priority)
main = BS.putStrLn . encode $ HIGH
I would've expected the JSON
derivation to just write out the enum as a string. Instead, it's the key to a hash! {"HIGH":[]}
Why is this the default behavior?