Empty JSON Array in Query String – Why No Parameter Is Emitted

Local only

Explain that an empty array has no primitive items to append and therefore emits no query pair for its key.

25 chars · 1 line

43 chars · 3 lines

1 parameter1 unique keys

Query array serialization

Why an empty JSON array disappears from the built query

Build Query creates one parameter per array item. An empty array contains nothing to append, so its key produces no pair while other properties continue to serialize normally. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Browser-native URLSearchParams behavior
  • Full URL and raw query parsing
  • Repeated parameter preservation
  • JSON object to query construction
  • Browser-local processing

Steps

  1. Build a query from an object containing an empty array.
  2. Observe that no pair is emitted for that key.
  3. Use null or an empty string only if the API requires an explicit key= value.

Zero array items means zero append operations

The builder iterates array values and calls URLSearchParams.append for each item. With an empty array, that loop has no items.

This differs from null or an empty string, both of which create one explicit empty pair.

Empty tag array with a normal q value

Only q is emitted.

JSON object

{"tag":[],"q":"vetatool"}

Built query string

q=vetatool

Common questions

Frequently asked questions

Is the empty array an error?

No. It is valid input and simply emits no pairs for that property.

How do I force tag=?

Use an empty string or null if an explicit empty value is required.

Does the builder use tag[] notation?

No. Non-empty arrays use repeated plain keys.

Debugging a specific Query String issue? Browse Query String troubleshooting.