This project converts between JSON Schema, JSON Instances, and Excel mappings.
It supports three modes:
- Schema β Excel: Generate an Excel mapping from a JSON Schema.
- Instance β Excel: Flatten a JSON instance into an Excel mapping.
- Excel β Instance: Reconstruct a JSON instance from an Excel mapping.
json-schema-mapper/
βββ files/input/ # put your JSON Schemas here
βββ files/output/ # Excel mapping will be saved here
βββ src/ # main Python code
βββ run.py # entrypoint
-
Create and activate a Python virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # Linux / macOS .venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Place your files in
files/input/, e.g.:files/input/0.6.0/FacilityRecord.json # schema files/input/0.6.0/sample_instance/FacilityRecord_instance.json # instance files/input/0.6.0/sample_instance_excel/FacilityRecord_instance_mapping.xlsx # excel -
Run the tool:
python run.py
-
Choose a mode when prompted:
Choose an action: 1 - Convert JSON schema(s) to Excel 2 - Convert JSON instance(s) to Excel 3 - Convert Excel(s) to JSON instance(s) -
Enter the input file or folder path and the output folder path (defaults are provided):
Enter input file or folder path [files/input]: Enter output folder path [files/output]:
-
Schema β Excel
files/input/0.6.0/FacilityRecord.json β files/output/0.6.0/FacilityRecord_mapping.xlsx -
Instance β Excel
files/input/0.6.0/sample_instance/FacilityRecord_instance.json β files/output/0.6.0/sample_instance/FacilityRecord_instance_mapping.xlsx -
Excel β Instance
files/output/0.6.0/sample_instance/FacilityRecord_instance_mapping.xlsx β files/output/0.6.0/sample_instance_json/FacilityRecord_instance_mapping_instance.json
Pathβ flattened JSON path (e.g.,root.child[0].name)Typeβ data type (string,int,float,bool,array,dict)Valueβ actual value or JSON-encoded list/dict
- Path β JSON path to the field
- Type β field type (string, number, object, array, ref)
- Required β whether the field is mandatory
- Description β schema description
- Ref β
$reftarget if applicable - Writable β whether you can directly enter a value
- Value β pre-filled with schema defaults if provided