fpml-convert — FpML interest-rate XML ⇄ JSON
FpML interest-rate
documents are deeply nested, namespaced XML with id/href
cross-references. fpml-convert is one lossless-enough mapping from an
FpML interest-rate-swap dataDocument to a plain nested value (objects,
arrays, scalars) and back — implemented three times so the same document
projects to the same shape whichever you reach for:
| Artifact | Language | Direction |
|---|---|---|
| JavaScript interpreter | single file, no dependencies — a companion interpreter for Structile | XML → value (read); value → XML (round-trip) |
| Python converter | Python 3, standard library only | XML ⇄ JSON |
| C++ converter | C++17, pure STL — no XML or JSON library | XML ⇄ JSON |
All three follow the same projection mapping, enforce the same supported-element subset, and are checked against the same test corpus — the JavaScript output is the reference, and the Python and C++ sides are compared to it byte-for-byte.
Try it in the browser: the live demo converts a sample FpML swap to JSON and back, running the JavaScript interpreter entirely client-side.
Get it
- Python:
pip install fpml-convert— pypi.org/project/fpml-convert - Everything else (JavaScript interpreter, single-file Python drop-in, C++ source, checksums): the downloads page. Each current release also has one “download everything” zip containing every artifact.
Use the JavaScript interpreter in Structile
Load it into the Structile viewer by URL:
https://danieltuzes.github.io/structile/?interpreter=https://danieltuzes.github.io/fpml-convert/interpreters/fpml-5.10.interpreter.js
Then open an FpML interest-rate-swap dataDocument (drop, paste, or
?url=) and it resolves with no companion file. The
interpreters/fpml-5.10.interpreter.js path is stable — a new FpML target
ships alongside it, it is never overwritten.
In Structile 6.19 and newer, the interpreter's entry in the ? popup
links back to these docs and shows its own converter build version as well
as the FpML 5.10 target. That makes it possible to compare a locally saved
interpreter with the current build on the downloads page.
Scope
FpML 5.10 confirmation view
(xmlns="http://www.fpml.org/FpML-5/confirmation"), interest-rate
swap (<swap> inside <trade> inside <dataDocument>). A document
outside that set is rejected rather than partially converted. FRA and
other products widen the supported subset in later releases.
Relationship to the FpML AWG JSON guidelines
ISDA's FpML Architecture Working Group published Guidelines on FpML to JSON Conversion (2019) and runs a hosted FpML to JSON Converter (beta). That mapping is tuned for interchange — attributes become plain inline keys, arrays and scalar types are driven by the XSD — and by the AWG's own statement "does not allow easy round tripping just based on the JSON".
fpml-convert is tuned for editing and round-tripping instead:
attributes are @-prefixed so they never collide with child element
names, references are marked so a viewer can resolve them, and the shape
is reversible without the schema. An AWG-interchange-shape output mode is
planned for the Python and C++ converters.