I have an object in the lower format, and I need to get all the values ββfrom the Price property at all levels of the object.
var o = { Id: 1, Price: 10, Attribute: { Id: 1, Price: 2, Modifier: { Id: 34, Price: 33 } } };
I was thinking about the LinqToJS and jquery.map() methods, but I would like to get the most general method possible. I tried this, but it only works on the first level:
var keys = $.map(o, function(value, key) { if (key == "Price") { return value; } });
json javascript jquery object linq
Diego fuks
source share