
17 Feb
2013
17 Feb
'13
3:25 p.m.
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"