Here I have a Persistent model:
Tip text Text created_at UTCTime updated_at UTCTime title Text category_id CategoryId
And the related ToJSON instance (I could not use deriveJSON ):
instance ToJSON Tip where toJSON (Tip text created_at updated_at title category_id) = object ["text" .= text, "created_at" .= created_at, "updated_at" .= updated_at, "title" .= title, "category_id" .= category_id]
This is almost correct, except that I also want a JSONify Tip id here ... but it is nowhere in the model! How can I do it? Is there a way to go from EntityVal to EntityKey ?
source share