JSONSelect icon indicating copy to clipboard operation
JSONSelect copied to clipboard

Wanted real path with dot-notation in JSONSelect.forEach callback

Open ghost opened this issue 13 years ago • 1 comments

Hello there! First of all, your project is awesome!

It would be great if you could add the real-path with dot-notation of matched values in place of second argument of callback in forEach-method.

For example, we have a JSON:

var data = { a: {x: 1, y: 2}, b: ["one", "two"] };

JSONSelect.forEach('.a > number, .b :nth-child(1n)', data, function( value, path ){ // Here I would love to see: // value - 1, path - "a.x" // value - 2, path - "a.y" // value - "one", path - "b.0" // value - "two", path - "b.1" });

Is it possible? Thank you in advance.

ghost avatar Feb 24 '12 00:02 ghost

I would like to see something similar in expr. So you could do something like ".a:expr(x.y = 2)" (note that x in this case is actually the variable for expr which will actually be a :).

studgeek avatar Apr 06 '12 19:04 studgeek