Sending a JSON string as a HTTP query parameter? Sending a JSON string as a HTTP query parameter? json json

Sending a JSON string as a HTTP query parameter?


Use:

$string = urlencode(json_encode($array));

and using the

$array = urldecode(json_decode($string));

to decode the string back into a PHP array.


Instead of using JSON use http_build_query(). It's already URL encoded and it might save you some space if that's the issue. It also handles multidimensional arrays.