On 02/17/2013 04:01 PM, Sergey Mironov wrote: > Hi folks. Hackage contains several JSON packages but as far as I see, > they all provide 'static' conversion from JSON format to Haskell data > type. Is there a method of converting object containing optional filed > 'a' to for example Maybe a.
Data.Aeson does this with the .:? operator: instance FromJSON Bar where parseJSON (Object v) = Bar <$> v .: "required" <*> v .:? "optional" _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe