- Goal: Technical
- Developer: Peter Takacs
- Feature Ticket: IDEMPIERE-7016
YAML and JSON Support for 2Pack (PackOut / PackIn)
The 2Pack packaging system (PackOut / PackIn) has historically only supported XML as its serialization format. This feature adds JSON and YAML as peer export/import formats, giving users the choice of a more human-readable and version-control-friendly output.
What Changed
| Aspect | Before | After |
|---|---|---|
| Export formats | XML only | XML, JSON, or YAML |
| Import detection | Looks for PackOut.xml | Auto-detects PackOut.xml, PackOut.json, or PackOut.yaml |
| Process parameter | None | New Export Format parameter on PackOut process |
| Default format | N/A | XML (unchanged — backward compatible) |
Architecture
A new IPackSerializer interface decouples PackOut from the SAX/XML pipeline, enabling pluggable serialization backends:
SAXPackSerializer— Adapter wrapping the existing XML path. Zero behavior change; all existing XML output is produced through this adapter.JacksonPackSerializer(base) +JsonPackSerializer+YamlPackSerializer— Jackson-based serializers that convert pack events to nested JSON/YAML structures using_childrenarrays for nested elements.DataPackInReader— Replays JSON/YAML as SAX events into the existingPackInHandler, so all import handler logic works unchanged regardless of the source format.- All
ElementHandlerimplementations have been refactored to useIPackSerializerinstead ofTransformerHandler, but their behavior remains identical for XML exports.
Exporting a Package in JSON or YAML
- Run the PackOut process as usual.
- In the new Export Format parameter, select:
- X — XML (default, backward compatible)
- J — JSON
- Y — YAML
- The process generates the corresponding file (
PackOut.xml,PackOut.json, orPackOut.yaml) in the package directory.
Importing a Package
No configuration is needed. PackIn auto-detects the format by probing for PackOut.json, PackOut.yaml, and PackOut.xml in that order. If the package was exported in JSON or YAML, DataPackInReader routes it through the same PackInHandler used by XML imports.
The PipoDictionaryService (OSGi bundle auto-install) also follows the same probing order when importing dictionary files.
Migration
A database migration creates:
- AD_Reference
200286("2Pack Export Format") with list values X / J / Y. - AD_Element and AD_Process_Para
ExportFormat2Packon theAD_PackOutprocess (ID 50004).
Dependencies
jackson-dataformat-yaml and snakeyaml have been added to the target platform, OSGi manifest imports, and all relevant launch configurations.