Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/odnoletkov/urlcomponents
- Owner: odnoletkov
- Created: 2021-05-18T19:03:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-23T12:01:38.000Z (about 2 years ago)
- Last Synced: 2024-12-13T21:07:45.541Z (11 days ago)
- Topics: json, url
- Language: Swift
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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