Skip to content

dmesha3/json-transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JTX (JSON Transform)

JTX is a Java 21 multi-module project for declarative JSON transformation. It lets you define a transformation spec and run it through a reusable engine, a CLI, or a REST API.

Modules

Path Purpose
modules/engine Core transformation engine and tests
modules/cli Picocli-based command-line runner
modules/api Spring Boot API with /v1/transform

Features

  • Source-to-target JSON mapping using JSON paths
  • Literal value assignment
  • Built-in transforms (trim, lowercase, uppercase, to_int, concat)
  • Validation with issue levels (ERROR, WARNING, INFO)
  • Execution modes: STRICT and LENIENT

Requirements

  • JDK 21
  • Maven 3.9+

Build and Test

mvn clean verify

Engine tests only:

mvn -pl modules/engine test

CLI Usage

Sample files are provided at repository root:

  • spec.json
  • input.json

Run:

mvn -pl modules/cli -am exec:java \
  -Dexec.mainClass=io.github.dmesha3.jtx.cli.Main \
  -Dexec.args="--spec spec.json --in input.json --out output.json"

API Usage

Start server:

mvn -pl modules/api -am spring-boot:run

Test endpoint:

curl -X POST "http://localhost:8080/v1/transform" \
  -H "Content-Type: application/json" \
  -d '{
    "spec":"{\"version\":1,\"mode\":\"LENIENT\",\"mappings\":[{\"from\":\"$.user.id\",\"to\":\"$.id\"}]}",
    "input":{"user":{"id":"123"}}
  }'

License

This project is licensed under GNU General Public License v3.0 or later. See LICENSE for full terms.

About

Declarative JSON transformation engine in Java, with reusable core, REST API, and CLI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages