Skip to content

Commit

Permalink
feat: ✨ add jq parser support for JSON transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Dec 22, 2024
1 parent a19aba5 commit b84f88c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/src/content/docs/reference/scripts/parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `parsers.json5` function parses the JSON5 format.
In general, parsing a JSON file as JSON5 does not cause harm, but it might be more forgiving
to syntactic errors. In addition to JSON5, [JSON repair](https://www.npmjs.com/package/jsonrepair) is applied if the initial parse fails.

- JSON5 example
- JSON5 example

```json5
{
Expand Down Expand Up @@ -272,8 +272,8 @@ const fences = parsers.fences("...")
Parses error, warning annotations in various formats
into a list of objects.

- [GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions)
- [Azure DevOps Pipeline](https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#example-log-a-warning-about-a-specific-place-in-a-file)
- [GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions)
- [Azure DevOps Pipeline](https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#example-log-a-warning-about-a-specific-place-in-a-file)
-

```js
Expand Down Expand Up @@ -322,6 +322,14 @@ used with `defData`.
const d = parsers.tidyData(rows, { sliceSample: 100, sort: "name" })
```
## jq
Apply a [jq](https://jqlang.github.io/jq/) query to a JSON object.

Check warning on line 328 in docs/src/content/docs/reference/scripts/parsers.md

View workflow job for this annotation

GitHub Actions / build

The `jq` section is added but lacks an explanation of how to use it with the parsers. Consider providing more details on how to apply a jq query to a JSON object using the parsers.
```js
const d = parsers.jq(rows, "map({ a })")
```

Check warning on line 331 in docs/src/content/docs/reference/scripts/parsers.md

View workflow job for this annotation

GitHub Actions / build

The `jq` example is provided but lacks an explanation of what the code does. Consider adding a brief description or comment to explain the purpose of the example.
## hash
Utility to hash an object, array into a string that is appropriate for hashing purposes.
Expand Down

0 comments on commit b84f88c

Please sign in to comment.