Commands

literalize

Convert data structures to native language literal syntax.

Usage

literalize [OPTIONS]

Options

--version

Show the version and exit.

-l, --language <language>

Required Target language for output.

Options:

ada | bash | c | clojure | cobol | commonlisp | cpp | crystal | csharp | d | dart | dhall | elixir | elm | erlang | forth | fortran | fsharp | gleam | go | groovy | haskell | hcl | java | javascript | json5 | jsonnet | julia | kotlin | lua | matlab | mojo | nim | nix | norg | objectivec | ocaml | occam | odin | perl | php | powershell | purescript | python | r | racket | raku | roc | ruby | rust | scala | scheme | sml | swift | systemverilog | tcl | toml | typescript | v | visualbasic | wren | yaml | zig

-f, --input-format <input_format>

Input data format.

Options:

json | json5 | yaml | toml

--pre-indent-level <pre_indent_level>

Number of indent levels to prefix each output line with.

--indent <indent>

Indentation string.

--include-delimiters, --no-include-delimiters

Include opening/closing delimiters.

--variable-name <variable_name>

Variable name for the output assignment.

--new-variable, --no-new-variable

Declare a new variable.

--modifier <modifiers>

Declaration modifier (language-specific, repeatable). Choices: const, final, private, protected, public, readonly, static.

--wrap-in-file, --no-wrap-in-file

Wrap output as a complete, valid source file.

--sequence-format <sequence_format>

Sequence format (language-specific). Choices: array, cell_array, dynamic_array, initializer_list, list, seq, sequence, slice, table, tuple, vec, vector.

--set-format <set_format>

Set format (language-specific). Choices: array, btree_set, dict, frozenset, hash_set, map_set, set, sorted_set, tree_set.

--date-format <date_format>

Date format (language-specific). Choices: cpp, csharp, dart, elixir, erlang, fsharp, go, haskell, iso, java, js, julia, kotlin, lua, matlab, nim, objc, ocaml, perl, php, python, r, raku, ruby, rust, scala, sml, swift, toml, yaml, zig.

--datetime-format <datetime_format>

Datetime format (language-specific). Choices: cpp, csharp, dart, elixir, epoch, erlang, fsharp, go, haskell, instant, iso, js, julia, kotlin, lua, matlab, nim, objc, ocaml, perl, php, python, r, raku, ruby, rust, scala, sml, swift, toml, yaml, zig, zoned.

--bytes-format <bytes_format>

Bytes format (language-specific). Choices: base64, binary, hex, python.

--comment-format <comment_format>

Comment format (language-specific). Choices: apostrophe, backslash, block, double_dash, double_slash, exclamation, hash, line, paren, paren_star, percent, semicolon, slash, star_angle.

--variable-type-hints <variable_type_hints>

Variable type hints (language-specific). Choices: always, never, safe.

--declaration-style <declaration_style>

Declaration style (language-specific). Choices: assign, auto, block, colon, const, declare, def, define, defparameter, dim, final, lazy_static, let, let_mut, let_mutable, local, mut, my, set, short, static, typed, val, var.

--dict-entry-style <dict_entry_style>

Dict entry style (language-specific). Choices: default, rocket, symbol.

--dict-format <dict_format>

Dict format (language-specific). Choices: btree_map, containers_map, default, dict, dictionary, hash_map, list_map, map, map_of_entries, object, ordered, sorted_dictionary, struct, unordered_map.

--float-format <float_format>

Float format (language-specific). Choices: fixed, repr, scientific.

--integer-format <integer_format>

Integer format (language-specific). Choices: binary, decimal, hex, octal, octal_c_style.

--numeric-literal-suffix <numeric_literal_suffix>

Numeric literal suffix (language-specific). Choices: auto, none.

--numeric-separator <numeric_separator>

Numeric separator (language-specific). Choices: none, underscore.

--string-format <string_format>

String format (language-specific). Choices: double, escaped, explicit, raw, single, verbatim.

--trailing-comma <trailing_comma>

Trailing comma (language-specific). Choices: no, yes.

--empty-dict-key <empty_dict_key>

Empty dict key handling (language-specific). Choices: error, positional.

--statement-terminator-style <statement_terminator_style>

Statement terminator style (language-specific). Choices: newline, none, semicolon.

--heterogeneous-strategy <heterogeneous_strategy>

Heterogeneous-collection strategy (language-specific). Choices: error, interface, object_variant, record, tagged_enum, tuple, union_type, variant.

--call-style <call_style>

Call style (language-specific). Choices: command, curried, keyword, named, object, positional, prefix, prefix_keyword.

--numeric-style <numeric_style>

Numeric style (language-specific). Choices: explicit, overloaded.

--language-version <language_version>

Target language version (language-specific). Choices: ada_2022, ans, ansi, c99, cpp20, dev_2024, dotnet_6, edition_2021, es2015, ghc2021, ieee_1800_2017, jdk_11, jdk_16, otp_25, py38, py39, r2022a, r7rs, sml_97, v0, v0_12, v0_14, v0_15, v0_19, v0_20, v0_4, v1, v10, v17, v1_11, v1_14, v1_18, v1_2, v1_9, v2, v2002, v2003, v2008, v24_5, v3, v4, v5, v5_1, v5_36, v5_4, v5_9, v6d, v7, v8, v8_1, v8_6.

--module-name <module_name>

Module/namespace name for languages whose wrap-in-file form introduces a named scope (e.g. C, C++, D, Erlang, Fortran, F#, Java, Objective-C, Occam, SystemVerilog).

--default-dict-key-type <default_dict_key_type>

Default type for dict keys (language-specific, free-form string).

--default-dict-value-type <default_dict_value_type>

Default type for dict values (language-specific, free-form string).

--default-sequence-element-type <default_sequence_element_type>

Default type for sequence elements (language-specific, free-form string).

--default-set-element-type <default_set_element_type>

Default type for set elements (language-specific, free-form string).

--default-ordered-map-value-type <default_ordered_map_value_type>

Default type for ordered map values (language-specific, free-form string).

--record-struct-name-prefix <record_struct_name_prefix>

Name prefix for the structs/records generated under –heterogeneous-strategy record (language-specific, free-form string). Names must be valid PascalCase identifiers for the target language.

--include-preamble, --no-include-preamble

Include language preamble (e.g. package declarations, imports).

--mode <mode>

Output mode: ‘literal’ for data literals, ‘call’ for function calls.

Options:

literal | call

--call-function <call_function>

Function name for call mode (e.g. ‘create_user’).

--call-params <call_params>

Comma-separated parameter names for call mode.

--per-element, --no-per-element

In call mode, each top-level list element becomes a separate call.

--ref-case <ref_case>

Identifier case for $ref markers in input data. When set, objects of the form {"$ref": "name"} are emitted as bare identifiers re-cased to the chosen convention instead of as nested dicts.

Options:

camel | kebab | pascal | snake | upper_snake

--ref-key <ref_key>

Marker key used to identify variable-reference mappings in the input data. A single-key dict whose key equals –ref-key and whose value is a string is treated as a ref marker.

Default:

'$ref'