JSON2YAML(1)

NAME
json2yaml - convert JSON configuration files to conf2-compatible YAML format

SYNOPSIS
json2yaml [-h] [-oOUTPUT_DIR] SOURCE...

DESCRIPTION
Converts JSON configuration files to YAML format compatible with conf2 modules. Processes individual JSON files or recursively converts all JSON files in directories. Output files retain original names with .yaml extension.

OPTIONS

-h, --help
    Show help message and exit

-o OUTPUT_DIR, --output OUTPUT_DIR
    Specify output directory (default: ~/yaml)

SOURCE...
    JSON file(s) or directory path(s) to process (at least one required)

CONVERSION RULES

•   JSON objects become nested YAML structures

•   All values gain metadata fields:
        _default: Original value
        _type: Type indicator ('s' for scalar, 'as' for arrays)

•   Array values are converted to string representations

•   Output version is fixed to 2.0.0.0-0k0.0

OUTPUT

Files
    <original_name>.yaml in output directory

Structure

    <filename>:
      2.0.0.0-0k0.0:
        <key1>:
          _default: <value>
          _type: <s|as>
        <key2>: ...

ENVIRONMENT

HOME
    Used when default output directory (~/yaml) is specified

EXAMPLES

Convert single file:
    json2yaml /etc/app/config.json

Convert directory with custom output:
    json2yaml -o ~/converted /path/to/json_configs/

Convert multiple sources:
    json2yaml file1.json file2.json ~/legacy_configs

EXIT STATUS

0   Success

1   Input errors (invalid files/paths)

2   Processing errors

NOTES

•   Original JSON arrays become string values in YAML

•   Nested objects are preserved recursively

•   Non-JSON files are skipped with warning

SEE ALSO
conf2(1), jq(1), yq(1)

AUTHOR
UKUI Configuration Tools Team