I am trying to store the values inside a javascript object notation based on the field selected by user. I was able to store the value in to a string separated with commas, Bt if the term Im trying to find is an array, I get [object object] in return, as it is an array. I want to know how I can store all the items in that array in to a variable separated by commas, here for example if I select "Time", then it should return Dec 9, 1, 2012
In the example, there is a function findProps, If I give the argument, entityCount inside findProps("entityCount", data), I will get a proper return type as 50, bsed on the json Ive provided. Bt If I add, findProps("Time", data);, since it is an array, it returns [object, object], not the values inside those arrays and I want the all values inside that array to be displayed(like Dec 9, 1, 2012) and the keys inside each array could be different and the depth of array could also be different. Im just using a static example here.
The part Ive reached returns the value if its a non array, http://jsbin.com/obehog/3/edit
There is another example which I came close to doing, http://jsbin.com/obehog/4/edit bt Im bad at recursion so Im stuck at this..
and the depth of the arrays could change, it wont be the same in each case. so going through loop will not work..
for (prop in obj) { obj[prop]; }to access all properties, including all entries in an array and add them to a string. I wouldn't do this as anything more than debugging however as you don't really want to do this on complex objects (functions and everything would get printed out by this).