Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

jmespath

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Issues
File Explorer

Advanced tools

jmespath

JMESPath implementation in javascript

    0.16.0latest

Version published
Maintainers
1
Weekly downloads
8,134,650
decreased by-11.5%

Weekly downloads

Readme

Source

jmespath.js

Build Status

jmespath.js is a javascript implementation of JMESPath, which is a query language for JSON. It will take a JSON document and transform it into another JSON document through a JMESPath expression.

Using jmespath.js is really easy. There's a single function you use, jmespath.search:

> var jmespath = require('jmespath'); > jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar.baz[2]") 2

In the example we gave the search function input data of {foo: {bar: {baz: [0, 1, 2, 3, 4]}}} as well as the JMESPath expression foo.bar.baz[2], and the search function evaluated the expression against the input data to produce the result 2.

The JMESPath language can do a lot more than select an element from a list. Here are a few more examples:

> jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar") { baz: [ 0, 1, 2, 3, 4 ] } > jmespath.search({"foo": [{"first": "a", "last": "b"}, {"first": "c", "last": "d"}]}, "foo[*].first") [ 'a', 'c' ] > jmespath.search({"foo": [{"age": 20}, {"age": 25}, {"age": 30}, {"age": 35}, {"age": 40}]}, "foo[?age > `30`]") [ { age: 35 }, { age: 40 } ]

More Resources

The example above only show a small amount of what a JMESPath expression can do. If you want to take a tour of the language, the best place to go is the JMESPath Tutorial.

One of the best things about JMESPath is that it is implemented in many different programming languages including python, ruby, php, lua, etc. To see a complete list of libraries, check out the JMESPath libraries page.

And finally, the full JMESPath specification can be found on the JMESPath site.

Keywords

FAQs

What is jmespath?

JMESPath implementation in javascript

Is jmespath popular?

The npm package jmespath receives a total of 6,475,776 weekly downloads. As such, jmespath popularity was classified as popular.

Is jmespath well maintained?

We found that jmespath demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 19 Jan 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc