JSON Converter

JSON Converter

URL to JSON converter online. Convert URL query strings to JSON objects and back. Handles nested parameters—free query string converter.

0 chars

Query String

JSON Object

Features

  • Convert query strings to JSON objects
  • Convert JSON objects to query strings
  • Array support: repeated params become arrays in JSON
  • Handle nested parameters and objects
  • Auto-decode: URL-encoded values are decoded
  • Bidirectional: convert either direction

Common Use Cases

  • Convert form data to JSON for APIs
  • Transform API responses to query strings
  • Debug request/response formats
  • Migrate between URL and JSON formats
  • Build query strings from JSON config

Query String and JSON Conversion

Query string to JSON conversion transforms URL parameters into structured JSON objects, and vice versa. This is useful for API development and data transformation.

Query to JSON:

?name=John&age=25&tags[]=red&tags[]=blue

↓

{
  "name": "John",
  "age": "25",
  "tags": ["red", "blue"]
}

JSON to Query:

{
  "search": "javascript",
  "filters": { "lang": "en", "year": 2024 }
}

↓

?search=javascript&filters[lang]=en&filters[year]=2024

Features:

  • Array handling - tags[]=a&tags[]=b or tags=a&tags=b
  • Nested objects - user[name]=John&user[age]=25
  • Auto encoding - Values are URL-encoded automatically

Examples

Valid - Simple query to JSON
Query: ?name=John&age=25&city=NYC

JSON:
{
  "name": "John",
  "age": "25",
  "city": "NYC"
}
Valid - Array parameters
Query: ?tags[]=javascript&tags[]=typescript

JSON:
{
  "tags": ["javascript", "typescript"]
}
Valid - JSON to query string
JSON: { "q": "Hello World", "limit": 10 }

Query: ?q=Hello%20World&limit=10

Frequently Asked Questions

How are arrays represented in query strings?

Arrays use repeated keys (?tag=red&tag=blue) or bracket notation (?tag[]=red&tag[]=blue). The converter supports both formats and outputs consistent JSON arrays: {"tag": ["red", "blue"]}.

Can I convert nested JSON objects to query strings?

Yes! Nested objects use bracket notation: {"user": {"name": "John", "age": 25}} becomes ?user[name]=John&user[age]=25. This is common in PHP-style query strings and form submissions.

Are values URL-encoded automatically?

Yes. When converting JSON to query strings, special characters are URL-encoded. "Hello World" becomes Hello%20World. When converting query to JSON, values are automatically decoded.

What happens to empty values?

Empty values in query strings (?key=) are converted to empty strings in JSON ({"key": ""}). In reverse, empty JSON strings become ?key=. null values are skipped.

Does JSON to query preserve object order?

JavaScript objects are unordered by spec, but modern engines preserve insertion order. The converter respects JSON key order when generating query strings, but query parameter order doesn't affect functionality.