I have this Query param that I already converted into JSON.
{"Id":"ZX0123455555,ZX0123455555,ZX0123455545"}
And I want it to become looks like this:
{
"Id": "ZX0123455555",
"Id": "ZX0123455555",
"Id": "ZX0123455545"
}
Just to simplify my JSon schema validation. Thanks
>Solution :
you can’t have an object with the same keys and multiply values but you can have this array:
const myObject = {"Id":"ZX0123455555,ZX0123455555,ZX0123455545"};
const myArray = myObject.Id.split(',')
const newArray = myArray.map((e)=>{return {Id:e}})
console.log(newArray)