Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/odnoletkov/urlcomponents

Convert URL to and from JSON
https://github.com/odnoletkov/urlcomponents

json url

Last synced: 11 days ago
JSON representation

Convert URL to and from JSON

Awesome Lists containing this project

README

        

# urlcomponents

Convert URL to and from JSON.

# Usage

Decode:

```
$ urlcomponents "https://example.com/path/to?parameter=value"
{
"host" : "example.com",
"path" : "\/path\/to",
"query" : {
"parameter" : "value"
},
"scheme" : "https"
}
```

Encode:

```
$ echo '{"scheme": "https", "host": "example.com", "path": "/file"}' | urlcomponents
https://example.com/file
```

# Install

brew install odnoletkov/tap/urlcomponents

# TODO

* Better errors

* Missing path when encoding