All articles

Query string vs. JSON: why GET parameters are so limited

A URL's query string is about the simplest data format there is: a list of key=value pairs separated by ampersands. That simplicity becomes a problem the moment you need to send anything more structured than a flat list of strings.

Why query strings are limited

The query string format was designed for plain HTML forms and has no built-in concept of data types, nesting, or arrays. Everything in it is text, so the number 42 and the string "42" are indistinguishable until some code explicitly parses them.

Arrays: bracket notation vs repeated keys

There's no single standard for encoding arrays in a query string, and different backend ecosystems settled on different conventions. PHP and Ruby on Rails both parse tags[]=a&tags[]=b straight into an array natively, and filter[status]=active into a nested structure — this bracket notation also shows up in REST APIs like Stripe's. ASP.NET model binding, on the other hand, typically expects the same key repeated without brackets: tags=a&tags=b. Node.js projects usually rely on a library such as qs, which supports bracket notation too but has to be configured explicitly. If the client and server disagree on the convention, the array data is silently dropped or mangled.

Why JSON solves this

JSON has built-in types (numbers, booleans, null) and native support for nested objects and arrays with no encoding conventions needed. That's why complex data in a POST body is usually sent as JSON, while query strings are reserved for simple, flat parameters like filters or a page number.

What this is useful for

  • Check exactly how a backend expects to receive an array parameter in a query string.
  • Convert URL parameters to JSON for easier debugging.
  • Understand why a complex data structure is better sent outside of GET parameters.

URL length limits

Most browsers and servers cap URL length at around 2000 characters (the exact limit varies by browser and web server), so query strings are physically unsuited to carrying large amounts of data. That's another reason POST requests with a JSON body are the standard choice for complex forms or array data, while GET with a query string stays reserved for short, simple parameters.

Try the tool