Skip to content

nlighten-oss/json-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7f1f2da · Feb 18, 2025

History

97 Commits
Nov 13, 2024
Feb 18, 2025
Apr 8, 2024
Feb 18, 2025
Feb 18, 2025
Jan 25, 2025
Feb 18, 2025
Apr 8, 2024
Feb 13, 2025
Apr 8, 2024
Apr 8, 2024
Nov 13, 2024
Nov 13, 2024
Nov 13, 2024
Apr 30, 2024

Repository files navigation

json-transform

Packages

Language Name Description License Status
Java co.nlighten.json-transform Java library for transforming JSON objects Apache License 2.0 Maven Central Version
JavaScript @nlighten/json-transform JSON transformers JavaScript implementation MIT npm
JavaScript @nlighten/json-transform-core Core types and utilities for handling JSON transformers MIT npm

Getting Started

Java

  • 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);

JavaScript

    // '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);