3

我正在开发一个 RESTful API,它将通过接收和发送的 JSON 消息进行操作。

问题是,当我将 API 调用的结果返回为 时application/json,响应是否也应该是 URL 编码的?

例如,它是否更正确

{"status":"OK","id":"WjY3T2g2Z1JGV1dFcXRqcXh4TDBlNnd1bHlwMVVLVzBRWnU1TTBnWGwrUEFKTHd5RlZSSytRMmdMTnlBS1ViUg%3D%3D"}

或者

{"status":"OK","id":"WjY3T2g2Z1JGV1dFcXRqcXh4TDBlNnd1bHlwMVVLVzBRWnU1TTBnWGwrUEFKTHd5RlZSSytRMmdMTnlBS1ViUg=="}
4

1 回答 1

4

As the name suggests url encoding is for URL's so there's no need to apply it to your JSON, unless, the value is a URL.

于 2013-02-27T16:58:28.897 回答