使用JSON.stringify
var j={
stationFilter: '',
groupId: -1,
lampEnable: -1,
cableEnable: -1,
leakEnable: -1,
runState: -1
};
JSON.stringify(j)
结果
'{"stationFilter":"","groupId":"-1","lampEnable":"0","cableEnable":"0","leakEnable":"0","runState":"1"}'