Simple Algorithm for Converting Url to Json

(no tags)

Algorithmia Platform License · Internet Access · Calls Other Algorithms

Try the API

" var params = getUrlVars('some=params&over=here');\r\nconsole.log(params);\r\n\r\nfunction getUrlVars(url) {\r\n    var hash;\r\n    var myJson = {};\r\n    var hashes = url.slice(url.indexOf('?') + 1).split('&');\r\n    for (var i = 0; i < hashes.length; i++) {\r\n        hash = hashes[i].split('=');\r\n        myJson[hash[0]] = hash[1];\r\n    }\r\n    return myJson;\r\n}\r\n"

Install & Use


curl -X POST -d '<INPUT>' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/JamesBond007/UrltoJson/0.1.0