How to write a FromJSON and ToJSON instance for unsupported field (CI Text)

Thanks @jaror. I went github code diving, and was able to do something which seems to work. Thanks!

This is what I did:


instance FromJSON (CI Text) where
  parseJSON = fmap CI.mk . parseJSON

instance ToJSON (CI Text) where
  toJSON = toJSON . CI.original
1 Like