I created a helper function called json_response() that does this that you can use after you merge.