Correctly handle JSON post / put