๐ Define-JSON Quick Reference
Installation
This project uses Poetry for Python dependency and environment management.
To install poetry:
# Recommended official installer (works on Linux, macOS, and WSL)
curl -sSL https://install.python-poetry.org | python3 -
# On Windows (PowerShell):
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -3 -
After installation, restart your shell or run
export PATH="$HOME/.local/bin:$PATH" # Linux/macOS/WSL
# or add it permanently to ~/.bashrc, ~/.zshrc, etc.
verify it worked (poetry --version) then clone this repo and install everything
git clone https://github.com/TeMeta/define-json.git
cd define-json
make setup
๐ Convert from Any Directory
JSON โ XML
PYTHONPATH=/Users/jeremyteoh/Projects/define-json python -c "
from src.define_json.converters.json_to_xml import DefineJSONToXMLConverter
from pathlib import Path
DefineJSONToXMLConverter().convert_file(Path('input.json'), Path('output.xml'))
print('โ
Done!')
"
XML โ JSON
PYTHONPATH=/Users/jeremyteoh/Projects/define-json python -c "
from src.define_json.converters.xml_to_json import DefineXMLToJSONConverter
from pathlib import Path
DefineXMLToJSONConverter().convert_file(Path('input.xml'), Path('output.json'))
print('โ
Done!')
"
Alternative (sys.path)
python -c "
import sys
sys.path.append('/Users/jeremyteoh/Projects/define-json')
from src.define_json.converters.json_to_xml import DefineJSONToXMLConverter
from pathlib import Path
DefineJSONToXMLConverter().convert_file(Path('input.json'), Path('output.xml'))
"
๐ Full Documentation
- Complete Guide: CONVERSION_README.md
- Project Overview: README.md
- Schema Documentation: docs/
๐งช Testing
# From project directory
make test-roundtrip
make convert
make roundtrip
Updating the model, refreshing schemas
- make your updates and run
make generate-allto update everything - new schemas are created in
/generatedfolder for review - to avoid accidental overwrites, copy schemas manually once approved to
src/define_json/schema - update the conversion tooling to handle any breaking changes