jmespath / jmespath/jmespath.jep

Function proposal - parseJson()

Open
#8 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Given a string containing embedded json, parse the json, and return the result.

This might be implemented something like:

```js
registerFunction('parseJson', ([json]) => JSON.parse(json), [{types: [TYPE_STRING]}]);
```

Examples:

```js
jmespath.search("\"true\"", "parseJson(@)")
// OUTPUTS: true

jmespath.search('"{\"a\":1, \"b\":\"c\"}"', "parseJson(@)")
// OUTPUTS {"a":1, "b":"c"}
```

The pattern of embedding json inside of strings in json is, unfortunately, somewhat common. For example, in AWS APIs.

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.