
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
jmespath-plus
Advanced tools
This is an extension of a fork of the original JMESPath.
It fully complies with the spec, and includes all tests
from the original jmespath.js project.
There is an article on the XML website claiming that You Should Be Using XSLT 3.0 to process JSON. If you take a look at the XSLT given for performing the transformation of the JSON in their example, it's (like XML in general) overly verbose.
I couldn't quite reproduce the same thing using the original JMESPath, but with my fork of JMESPath that allows for the
addition of custom functions, I could. By adding the toPairs function, there is now an elegant solution to the example
from that XML article:
toPairs(employees)[*]
.merge(
[1],
{
id: [0],
fullName: join(' ', [[1].firstname, [1].surname]),
reverseName: join(', ', [[1].surname, [1].firstname])
}
)
The original jmespath.js repository has not been updated for many years. There are many unanswered issues, including this one inquiring about the project status. Also on the website repo there is an issue about the project status. I submitted a pull request.
In the meantime, I published my fork as a "scoped package" on NPM here.
This package is an extension of that fork, with some extra utility functions that I find useful. I added a few bits of lodash and some string functions. Open an issue if you need any extra functions added, or use the code in
src/main.js as an example and extend @daz.is/jmespath.js with your own functions.
Install from npm:
npm install --save jmespath-plus
https://codesandbox.io/embed/focused-lichterman-y867l?fontsize=14&hidenavigation=1&theme=dark
const jmespath = require('jmespath-plus');
const v = jmespath.search({ a: 42 }, 'a');
console.log(v); // output = 42
$ character can be used within expressions to reference the rootThe following extra functions have been added:
toLowerCase(STRING)Converts string to lowercase.
trim(STRING)Removes any spaces from beginning and end of string.
split(STRING, separator:STRING)Split string by separator.
zip(...ARRAYS)toPairs(OBJECT)Convert an object into an array of key value pairs.
fromPairs(ARRAY)Convert an array of key value pairs back into an object.
omit(OBJECT, ...KEYS)Return the object but omitting the items with the specified keys.
pick(OBJECT, ...KEYS)Return a new object with only the items with the specified keys.
FAQs
jmespath.js extended with functions from lodash
We found that jmespath-plus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.