javascript - JSON: How do I prepend parameter name to each of its values? -


i use following code return json string , convert url.

function runmyreport(){          var json = ko.tojson(getparams());         var url = "/report/rvp.aspx?id=" + guestid() + "&" + $.param({ "parameters": json }); } 

the problem if parameter has multiple values render as:

{"product" : "1,2,3"}

and need prepend parameter name each value , return as:

{"product" : "1", "product" : "2", "product" : "3"}

can tell me how can accomplish this?

the reason need created drop-down field using below js array of objects.

var product= [         { name: "all", id: "1, 2, 3" },         { name: "key1", id: "1" },         { name: "key2", id: "2" },         { name: "key3", id: "3" } 

the object "all" has multiple values , when selected displays in json "product" : "1,2,3". problem ssrs accepts multiple values in following query string format:

querystring.aspx?product=1&product=2&product=3 


Comments