Language | Name | Description | License | Status |
---|---|---|---|---|
Java | co.nlighten.json-transform | Java library for transforming JSON objects | Apache License 2.0 | |
JavaScript | @nlighten/json-transform | JSON transformers JavaScript implementation | MIT | |
JavaScript | @nlighten/json-transform-core | Core types and utilities for handling JSON transformers | MIT |
- In your application initialization code set the JsonTransformerConfiguration with your preferred provider:
public static void main(String[] args) {
JsonTransformerConfiguration.set(new GsonJsonTransformerConfiguration());
// ...
}
- See available adapters here
Then in the code where you want to transform JSON objects:
// '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);
// '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);