Question: What if I pass my searching params in uri request in json-format like this:

```
http://example.com/?search={"title":"Some+Title","category":12}

```

instead of

```
http://example.com/?title=Some+Title&category=12

```

Before decode json-request I can filter it with some functions like strip\_tags(), strpslashes(), etc... But I can do the same with $\_SERVER['QUERY\_STRING'] with serialize()/unserialize(). Or apply string-filters to N string-params of request, not once to whole request.

Which way do you think will be better, usable and faster to process?

### With json

```
$request = $_GET['search'];
$request = stripslaches(strip_tags($request));
$params  = json_decode($request);

```

Answer: 
Sending an encoded JSON string is possible, as any string (you should [`urlencode`](http://php.net/manual/function.urlencode.php) and [`urldecode`](http://php.net/manual/function.urldecode.php) it though, no stripping needed) but it's *not* really a good way to do it - use the standard way of passing data in request - if you have only simple data to send, just translate it into traditional GET variables (it's really easy, e.g. with [`http_build_query`](http://php.net/manual/function.http-build-query.php) as Tomasz suggests). You may also run into difficulities with the request URI length (see [What is the maximum length of a URL in different browsers?](https://stackoverflow.com/q/417142/523100)) if you pack too much data into the JSON object.
Why don't you just represent everything with JSON?

```
http://www.example.com/{"article":"something","page":12,"fragment":"#menu"}

```

Query strings are already used to represent flat lists of key-value pairs, so what problem does your JSON solution solve? You'll just be adding a new layer of complexity without any benefits.