javascript array into object with same key names -
i have unusual problem solve here. have array of guids
[ "c01f8237-72c8-4fa6-9c53-1915750385aa", "2c8a471b-c408-436c-81b1-3f3867d8ffb4", "27a44d46-12bd-4784-ceed-57ada31b0e33" ]
this array has transformed into:
{ id: "c01f8237-72c8-4fa6-9c53-1915750385aa", id: "2c8a471b-c408-436c-81b1-3f3867d8ffb4", id: "27a44d46-12bd-4784-ceed-57ada31b0e33" }
i know shouldn't done, unfortunately cannot control end part. idea?
thanks
the whole point of dictionary key uniquely maps value. desired output attempts duplicate key , therefore neither possible nor make sense.
if you're passing backend (as suggest), of course can manually build string pass on wire duplicates keys in payload, won't able in javascript first. you'll have manually build string.
also note can call format whatever want, you can't call json , can't use json libraries build (because it's not json). if api expects custom format, need write code build custom format.
Comments
Post a Comment