DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/jmespath package

0.16.0 • Public • Published


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,

> var jmespath = require('jmespath');
>{foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "[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[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:

>{foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "")
{ baz: [ 0, 1, 2, 3, 4 ] }

>{"foo": [{"first": "a", "last": "b"},
                           {"first": "c", "last": "d"}]},
[ 'a', 'c' ]

>{"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.

Package Sidebar


npm i jmespath

Weekly Downloads






Unpacked Size

81.1 kB

Total Files


Last publish


  • jamesls