Return json or the promise js handlers fail.