https://github.com/nlighten-oss/json-transform
JSON transformation library
https://github.com/nlighten-oss/json-transform
jolt jq json json-transformation
Last synced: about 1 month ago
JSON representation
JSON transformation library
- Host: GitHub
- URL: https://github.com/nlighten-oss/json-transform
- Owner: nlighten-oss
- Created: 2024-04-07T08:08:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-29T12:49:28.000Z (about 2 months ago)
- Last Synced: 2025-04-15T06:15:06.239Z (about 1 month ago)
- Topics: jolt, jq, json, json-transformation
- Language: TypeScript
- Homepage: https://nlighten-oss.github.io/json-transform/
- Size: 1.48 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# json-transform
- [Documentation](https://nlighten-oss.github.io/json-transform/)
## Packages
| Language |Name| Description |License|Status|
|------------|---|---------------------------------------------------------|---|---|
| Java |[co.nlighten.json-transform](./java/json-transform)| Java library for transforming JSON objects |Apache License 2.0||
| JavaScript |[@nlighten/json-transform](./javascript/json-transform)| JSON transformers JavaScript implementation|MIT||
| JavaScript |[@nlighten/json-transform-core](./javascript/json-transform-core)| Core types and utilities for handling JSON transformers |MIT||
| JavaScript |[@nlighten/monaco-json-transform](./javascript/monaco-json-transform)| Monaco editor extension for JSON transformers |MIT||## Getting Started
### Java
- In your application initialization code set the JsonTransformerConfiguration with your preferred provider:
```java
public static void main(String[] args) {
JsonTransformerConfiguration.set(new GsonJsonTransformerConfiguration());
// ...
}
```- See available adapters [here](https://github.com/nlighten-oss/json-transform/tree/main/java/json-transform/src/main/java/co/nlighten/jsontransform/adapters)
Then in the code where you want to transform JSON objects:
```java
// 'definition' is a JSON (in your selected provider's structure)
// defining the spec of the transformer
JsonTransformer transformer = new JsonTransformer(definition);
// 'input' - The input of the transformer (referred as '$')
// 'additionalContext' - (optional) Map of additional inputs to refer during transformation
Object transformed = transformer.transform(input, additionalContext);
```### JavaScript
```js
// 'definition' is the spec of the transformer
const transformer = new JsonTransformer(definition);
// 'input' - The input of the transformer (referred as '$')
// 'additionalContext' - (optional) Map of additional inputs to refer during transformation
const result = await transformer.transform(input, additionalContext);
```