Skip to content

Instantly share code, notes, and snippets.

@indatawetrust
Last active August 20, 2016 11:17
Show Gist options
  • Save indatawetrust/d96f19cbf52cb272cb9cc5e10a2cea4e to your computer and use it in GitHub Desktop.
Save indatawetrust/d96f19cbf52cb272cb9cc5e10a2cea4e to your computer and use it in GitHub Desktop.
const jsonGET = (json) => {
let _ = ""
for(let i in json){
_ += `${i}=${json[i]}&`
}
if(_.split('').reverse()[0] == '&'){
_ = _.split('')
_.pop()
_ = _.join('')
}
return _
}
console.log(jsonGET({a:1,b:2,c:3}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment