toJson

fun toJson(): Map<String, Any?>

Returns a snake_case Map<String, Any?> ready for JSON encoding.

The returned map is a LinkedHashMap so insertion order is preserved across invocations; this gives deterministic byte-equal output for fixtures and regression tests. Null-valued optional fields are omitted entirely rather than serialized as JSON null, matching the spec's optional-field semantics.

Return

The ordered key-value map suitable for passing to JsonElement conversion helpers.