var data = { "tel":"18612341234", "timestamp":"1514736000", "channel":"SZQF", "signmsg":"XXX", } var arr = [] for(var key in data){ arr.push(key) } var newArr = arr.sort(function(a,b){return a.localeCompare(b)}) var str = "" for(var key of newArr){ str += key + "=" +data[key] + "&" } console.log(str.substr(0, str.length-1))