jmespath / jmespath/jmespath.js

Numeric literals can only wrapped with backticks, not single quotes

Open
#85 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
847
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Hi,

According to the [JMESPath specification](https://jmespath.org/specification.html):

```
literal = "`" json-value "`"
```

This implementation doesn't abide to the specification and allows literals to be also wrapped with single quotes.

```json
{
"status":"GOOD",
"fruits":[
{
"name":"Apple",
"details": {
"size":500
}
},
{
"name":"Cherry",
"details": {
"size":100
}
}]
}
```

```
fruits[?details.size >= `500`]
fruits[?details.size >= '500']
```

On the online evaluator on https://jmespath.org/ (using this implementation), both following expressions work.
Only the former should. The latter should return an empty array.

For the record, the [Java implementation](https://github.com/burtcorp/jmespath-java) works as expected.

Regards

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.