Skip to content
jc-rs
GitHub

Private URL component parser

URL Parser: Break a URL Into Its Parts

jc-rs separates a complete URL into its scheme, credentials, host, port, path, query, and fragment. It also derives filename and path fields and retains every value attached to a repeated query key.

url--urlv1.0.0

Universalstring

Try the real parser

Paste input on the left. The same Rust parser that ships in the binary runs locally in this page and writes its JSON on the right.

browser · WebAssembly
Loading the local parser.
inputeditable
jc-rs --urlJSON
Use the Left and Right arrow keys to highlight the matching value in the input.
{
  "decoded": {
    "extension": "json",
    "filename": "report.json",
    "fragment": "results",
    "hostname": "example.com",
    "netloc": "example.com",
    "parent": "/",
    "password": null,
    "path": "/report.json",
    "path_list": [
      "report.json"
    ],
    "port": null,
    "query": "tag=rust&tag=cli",
    "scheme": "https",
    "stem": "report",
    "url": "https://example.com/report.json?tag=rust&tag=cli#results",
    "username": null
  },
  "encoded": {
    "extension": "json",
    "filename": "report.json",
    "fragment": "results",
    "hostname": "example.com",
    "netloc": "example.com",
    "parent": "/",
    "password": null,
    "path": "/report%2Ejson",
    "path_list": [
      "report.json"
    ],
    "port": null,
    "query": "tag%3Drust%26tag%3Dcli",
    "scheme": "https",
    "stem": "report",
    "url": "https%3A%2F%2Fexample%2Ecom%2Freport%2Ejson%3Ftag%3Drust%26tag%3Dcli%23results",
    "username": null
  },
  "extension": "json",
  "filename": "report.json",
  "fragment": "results",
  "hostname": "example.com",
  "netloc": "example.com",
  "parent": "/",
  "password": null,
  "path": "/report.json",
  "path_list": [
    "report.json"
  ],
  "port": null,
  "query": "tag=rust&tag=cli",
  "query_obj": {
    "tag": [
      "rust",
      "cli"
    ]
  },
  "scheme": "https",
  "stem": "report",
  "url": "https://example.com/report.json?tag=rust&tag=cli#results",
  "username": null
}

Hover over a JSON value, or focus the JSON pane and use the Left and Right arrow keys, to trace it to the input. Parsing runs inside this tab in WebAssembly. Pasted text and opened files are not uploaded. If site analytics is enabled, it may receive page-level visit data such as the URL, title, and referrer; text in this editor is never included.

Accepted input

One absolute URL with a scheme, such as https://, ftp://, or another scheme accepted by the URL parser. Plain relative paths are rejected. Angle brackets and a leading URL: wrapper are removed. Percent escapes in query keys and values are decoded, but + is not treated as a space.

What the JSON contains

  • Top-level fields include scheme, netloc, hostname, port, username, password, path, query, and fragment.
  • Path helpers include parent, filename, stem, extension, and path_list; duplicate path slashes are collapsed.
  • query_obj maps each percent-decoded key to an array, preserving repeated values instead of silently keeping only one.
  • Nested encoded and decoded objects show parser-produced component views. They do not turn arbitrary free-form text into or out of percent encoding.

What you can do here

  • Parse a URL into host, path, query, and fragment
  • Read repeated query-string values without fetching the URL
  • Inspect the parser's encoded and decoded component views

Use the same parser in a shell

$ printf '%s\n' 'https://example.com/report.json?tag=rust' | jc-rs --url

The browser tool is for inspection. The CLI form is the useful one in scripts, pipes, containers, and repeatable checks.

Continue with the parsed JSON

Fixture coverage

noneThe reference corpus ships no oracle-valid fixture for this parser, so the differential cannot speak for it. That is reported, not hidden.

Magic syntax

not availableThis parser reads a file or a string rather than a command, so there is nothing for jc-rs to run. Pipe it in.

Source: crates/jc-rs-parsers/src/string/url.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare