I am developing a RESTful API which will operate through JSON messages, both received and sent.
The question is, when I return the result of an API call as application/json, should the response also be URL-encoded?
For example, is it more correct
{"status":"OK","id":"WjY3T2g2Z1JGV1dFcXRqcXh4TDBlNnd1bHlwMVVLVzBRWnU1TTBnWGwrUEFKTHd5RlZSSytRMmdMTnlBS1ViUg%3D%3D"}
or
{"status":"OK","id":"WjY3T2g2Z1JGV1dFcXRqcXh4TDBlNnd1bHlwMVVLVzBRWnU1TTBnWGwrUEFKTHd5RlZSSytRMmdMTnlBS1ViUg=="}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With