Query String Builder Requires JSON Object – Fix Array or Scalar Input

Local only

Require a top-level JSON object so property names can become query parameter keys.

18 chars · 1 line

34 chars · 3 lines

1 parameter1 unique keys

Query builder shape error

Why Build Query requires a top-level JSON object

A query string needs named parameter keys. Build mode therefore maps object properties to query keys and rejects arrays, strings, numbers, booleans, and null at the top level. 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. Confirm the input parses as JSON.
  2. Replace a top-level array or scalar with an object containing named properties.
  3. Keep arrays only as property values when repeated parameters are intended.

Object keys provide query parameter names

An object such as {"q":"vetatool"} has an explicit key that can become q=vetatool. A top-level array has values but no stable parameter names.

Arrays are supported one level down as repeated values for a named object property.

Array input versus object input

Both snippets are valid JSON, but only the object has a parameter name.

Unsupported top-level JSON

[["q","vetatool"]]

Supported JSON object

{"q":"vetatool"}

Common questions

Frequently asked questions

Can a property value be an array?

Yes, if every array item is a supported primitive. It becomes repeated query parameters.

Why not infer keys for an array?

The converter avoids inventing parameter names or positional conventions.

Is null a valid top-level input?

No. Build Query requires a non-null JSON object.

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