Urlencode JavaScript
var url = encodeURIComponent('url');
QP2
var url = encodeURIComponent('url');
Check out the built-in function encodeURIComponent(str) and encodeURI(str).
In your case, this should work:
var myOtherUrl =
"http://example.com/index.html?url=" + encodeURIComponent(myUrl);
var encodeURI = encodeURIComponent("&")
encodeURIComponent('')
# -r enable raw output
jq -r .[0].string FILE.json