REF: Assert json roundtrip equal
Replaces a some frequently repeated lines with a function.

- [x] closes #28555
- [ ] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
Hello @bganglia! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-09-27 21:29:07 UTC This is really nice, thanks.  Looks like the linter is finding trailing whitespace that you need to delete Thank you, yes. I will do that now. Thanks @bganglia nice PR and great first contribution. Would welcome more PRs to tackle other issues!