Hi, `findAll` is for searching through Enumerables -- e.g., Array-like things. Unless the "JSON object" you're talking about is an Array, it's not going to help you.
Looping through all of the properties in an object is trivial, though: var name, value; for (name in obj) { value = obj[name]; // use `value` } That loops through all properties of the object, including any it inherits from its prototype (but skipping ones marked as "don't enumerate me" -- like the `length` property of an Array). If you only want properties directly owned by the object and *not* by its prototype: var name, value; for (name in obj) { if (obj.hasOwnProperty(name)) { value = obj[name]; // use `value` } } This is not recursive, so if your object looks like this: var obj = { foo: 42, bar: { a: "alpha", b: "beta" } }; ...the loop will loop through the `foo` and `bar` keys (in no particular order), but not `bar`'s properties. For that you'd need a recursive function: function deepLoop(obj, ownOnly) { var name, value; for (name in obj) { if (!ownOnly || obj.hasOwnProperty(name)) { value = obj[name]; if (typeof value === "object") { deepLoop(value, ownOnly); } else { // use `value` } } } } FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / comn www / crowder software / comn On Sep 17, 5:15 am, kstubs <kst...@gmail.com> wrote: > How do you chain together findAll and each? I have a Json object > which I would like to filter, and was thinking to findAll, followed by > an each on the findAll results. What is the best approach? > > Thanks, > Karl.. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.