Json string in url: urlencode or not?


I was wondering if you have to urlencode/urldecode a json string that would be sent/retrieved from the url (using $_GET).


It’s a common practice to URL encode anything that is not an alphanumeric or numeric value been added to the URL as a query string, so yes i would recommend you do URL encode your JSON string.

It’s going to be very long… base_64 encode/decode would help, wouldn’t it? Is it good practice?

If the JSON string is going to get longer then say 300 characters then i would recommend you use $_POST instead of $_GET as it’s less overhead for the browser to process

In my scenario, javascript has to read the JSON string too. No access to _POST.