{"uid":"cap_KyG2wCHOQRrKMkukSu1nH","slug":"url-query-string-parser-and-builder-5eb584dc","name":"URL Query String Parser and Builder","description":"Parse a URL query string into keys and values (repeats grouped) or build one from a JSON object, with duplicates flagged.","url":"https://url-text-tools.x402tookit.com/query-string?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["query"],"properties":{"query":{"type":"string","description":"For parse: the query string, with or without the leading ?. For build: a JSON object of keys to values or arrays"},"action":{"type":"string","description":"parse (default) or build"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"pairs":{"type":["array","null"],"items":{"type":"object","properties":{"key":{"type":["null","string"]},"value":{"type":["null","string"]}}}},"action":{"type":["null","string"]},"source":{"type":["null","string"]},"grouped":{"type":["null","object"],"properties":{"a":{"type":["array","null"],"items":{"type":"string"}},"b":{"type":["array","null"],"items":{"type":"string"}},"flag":{"type":["array","null"],"items":{"type":"string"}}}},"reasons":{"type":["array","null"],"items":{"type":"string"}},"skipped":{"type":["null","number"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"duplicateKeys":{"type":["array","null"],"items":{"type":"string"}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_JfvCDd7W9GkAjq-9ehijb","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Parses a URL query string into grouped key-value pairs or builds a query string from a JSON object, flagging duplicate keys.","exampleAgentPrompt":"Parse the query string 'a=1&b=hello&a=2&flag=' into structured key-value pairs and group any repeated keys — also flag any duplicates.","exampleUseCases":[{"title":"Debugging duplicate query parameters","prompt":"I've got this URL query string: 'id=42&filter=active&filter=pending&sort=asc' — can you parse it into structured groups and tell me which keys appear more than once?"},{"title":"Building query string from API config","prompt":"Take this JSON object {\"page\": 1, \"limit\": 50, \"tags\": [\"news\", \"tech\"]} and build a URL query string from it so I can append it to my API request."},{"title":"Auditing tracking parameters in query strings","prompt":"Parse out all the key-value pairs from this query string 'utm_source=google&ref=homepage&session=abc123&ref=sidebar' so I can see what's there and whether any keys are repeated."}],"resultDescription":"Returns a structured object containing: an array of key-value pairs, a grouped object where repeated keys are collected into arrays, a list of duplicate key names, the action performed (parse or build), the source query string, a summary, and metadata like timestamp and any degraded-mode warnings.","failureModes":["Malformed JSON passed as build input returns an error or skipped count","Empty query string returns empty pairs and grouped object","Extremely long query strings may be truncated or skipped","Invalid action value (not 'parse' or 'build') defaults to parse","Missing required 'query' parameter causes request failure"],"whenToPreferThis":"Use this endpoint when you need to programmatically parse or construct URL query strings without writing custom parsing logic, especially when handling repeated keys or needing grouped output. Prefer this over generic string-splitting when you need RFC-compliant handling of duplicates and structured output including a duplicate-keys flag.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:30:07.229Z","isFirstParty":false,"canonicalSlug":"url-query-string-parser-and-builder-5eb584dc"}