Fix to_json Memory Tests
Inspired by @mroeschke I noticed the JSON tests weren't actually measuring anything because you need to return something for the `mem_` tests which these weren't. In any case probably better served as `peakmem_`

Can you re-push following #28258 All fixed up @jbrockmendel - thanks for the heads up thanks @WillAyd 