Refactored JSON reformatting for a common invocation