I am trying (in Javascript an Coldfusion) to convert: {“val1”:“member”,“val2”:“book”,“val3”:“journal”,“val4”:“new_member”,“val5”:“cds”},
into this: { member,book,journal,new_member,cds}
When you define an object, you need to associate the key and value in some way, so objects cannot work as you want there.
Currently the object you’re starting with would have its values access as obj.val1, obj.val2, etc…
Let’s start with finding out what data structure you are wanting, and why are you wanting to eliminate quotes?
Thank you for your reply. The reason that i need this ({member,book,journal,new_member,cds}) is that the search server i am using unfortunately consumes that kind of “datatype” (for querying). This obj: {“val1”:“member”,“val2”:“book”,“val3”:“journal”,“val4”:“new_member”,“val5”:“cds”} is the response that I got from the client. So, I end up with this:
var tata={"val1":"member","val2":"book","val3":"journal","val4":"new_member","val5":"cds"}
var arr=[]
for (var i in tata) {
arr.push(tata[i])
};
console.log(arr);
wrd = new Array(arr)
var joinwrd = wrd.join(",");
console.log('{' + joinwrd + '}');