We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given a array or object output an array with values indexed on keys:
array
object
For example in Javascript one might implement it as follows:
registerFunction( 'entries', ([resolvedArgs]) => { return Object.entries(resolvedArgs); }, [{ types: [TYPE_OBJECT, TYPE_ARRAY] }], );
Examples:
// With ARRAY input: jmespath.search([1,"2", null, ["a", 2, "foo"], {b: "z"}, true, false], "entries(@)") // OUTPUTS: [ // [ '0', 1 ], // [ '1', '2' ], // [ '2', null ], // [ '3', [ 'a', 2, 'foo' ] ], // [ '4', { b: 'z' } ], // [ '5', true ], // [ '6', false ] // ]
// With **OBJECT** input: jmespath.search({a: 1, b: [2, 3], c: null, 4: {x: 0}}, 'entries(@)') // OUTPUTS: [ // [ '4', { x: 0 } ], // [ 'a', 1 ], // [ 'b', [ 2, 3 ] ], // [ 'c', null ] // ]
The text was updated successfully, but these errors were encountered:
This looks very similar to the items function that was proposed a while back. We plan to include this in the next version of our specification.
Sorry, something went wrong.
It's slightly different from the items proposal in that it would be polymorphic by working on both JSON objects and JSON arrays.
No branches or pull requests
Given a
array
orobject
output an array with values indexed on keys:For example in Javascript one might implement it as follows:
Examples:
The text was updated successfully, but these errors were encountered: