https://github.com/serras/json-select-transform
Library for matching and transformation of JSON documents
https://github.com/serras/json-select-transform
Last synced: about 1 year ago
JSON representation
Library for matching and transformation of JSON documents
- Host: GitHub
- URL: https://github.com/serras/json-select-transform
- Owner: serras
- License: bsd-3-clause
- Created: 2021-03-02T19:56:50.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-04T09:51:50.000Z (over 5 years ago)
- Last Synced: 2025-01-31T07:41:40.928Z (over 1 year ago)
- Language: Haskell
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `json-select-transform`
A Haskell library for matching/selection and transformation of JSON document.
Inspired by [ST.js](https://selecttransform.github.io/site/).
### `select`
- template: `{ "number" : "{{x}}" }`
- document: `{ "number" : 1 }`
- result: `{ x -> 1 }`
### `transform`
- template: `{ "number" : "{{x}}" }`
- assignment: `{ x -> 1 }`
- result: `{ "number" : 1 }`
### `transform` with interpolation
- template: `{ "message" : "the result is {{x}}" }`
- assignment: `{ x -> 1 }`
- result: `{ "message" : "the result is 1" }`
### `transform` with array
- template: `{ "{{#each n}}" : { "number" : "{{n}}" } }`
- assignment: `{ n -> [1, 2] }`
- result: `[ { "number" : 1 }, { "number" : 2 } ]`