currently using `serialize` in some cases, and `json_encode` in others (not good as it depends on the `json` extension).