Serializes spec to the JSON contract consumed by the Rust backend.
spec
Usage
Source
filterspec.spec_to_json(spec)