Refactor json macro

This should be behaviorally identical, but cleaned up a bit.  There were three very similar macro implementations that could be merged into one.  This should make it easier to maintain and enhance the macro going forward.