module

Krikri::PyDump

Byte-exact ports of the two serializers behind ansible's to_json / to_nice_json / to_yaml / to_nice_yaml filters: Python's json.dumps and PyYAML's yaml.dump (AnsibleDumper, allow_unicode=True). Verified against ansible-core 2.19.11 output for scalars, nested collections, quoting edge cases, flow/block selection and 80-column wrapping.

Class methods

json(value : JSON::Any, indent : Int32 | Nil = nil, sort_keys : Bool = false) : String

---- json.dumps -----------------------------------------------------

Source
py_float_repr(value : Float64) : String

Python repr(float)

Source
yaml(value : JSON::Any, indent : Int32 = 2, default_flow_style : Bool | Nil = nil, sort_keys : Bool = true, width : Int32 = 80) : String

---- yaml.dump ------------------------------------------------------ default_flow_style: nil (PyYAML default: flow for scalar-only collections), false (block everywhere, to_nice_yaml).

Source

Nested types