Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # The URL
- URL="https://example.com/path?param1=value1¶m2=value2¶m3=value%20with%20spaces"
- # Cleanup/Decode URL Strings
- CLEAN_URL="$(busybox httpd -d "$URL")"
- # Remove Domain
- QUERY_STRING=$(echo "$CLEAN_URL" | cut -d '?' -f 2)
- # Vars as JSON
- echo "$QUERY_STRING"| jq -R 'split("&") | map(split("=") | {key: .[0], value: .[1]}) | reduce .[] as $item ( {}; .[$item.key] = $item.value )'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement