{-# LANGUAGE DeriveDataTypeable #-} import System.IO import Text.JSON.Generic data Person = Person {name :: String} deriving (Show, Data, Typeable) main = do let alex = Person {name = "Alex"} putStrLn . encodeJSON $ alex let alexJson = encodeJSON $ alex putStrLn . show $ (decodeJSON alexJson :: Person)
No comments:
Post a Comment