LoginSignup
3
5

More than 5 years have passed since last update.

オブジェクトをGETリクエストのパラメータ形式に変換する。

Posted at

{key=value}をkey=valueの形に変換し&でつなぐ。

var param = {
    user:"hoge",
    page:1
}

Object.keys(param).map(function(key){ return key+"="+ param[key] }).join("&")
-> "user=hoge&page=1"
3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5