Skip to content

Encode command

bash
codewise encode --input FILE --output FILE [flags]
FlagShortDescription
--input-iInput path
--output-oOutput path
--json-to-yamlConvert JSON to YAML
--env-to-jsonConvert an ENV file to JSON
--base64Use Base64 mode
--decodeDecode rather than encode in Base64 mode
--force-fOverwrite an existing output file

Examples

bash
# YAML to JSON (default structured conversion)
codewise encode -i app.yaml -o app.json

# JSON to YAML
codewise encode -i app.json -o app.yaml --json-to-yaml

# ENV to JSON
codewise encode -i .env -o env.json --env-to-json

# Base64 round trip
codewise encode -i input.txt -o encoded.txt --base64
codewise encode -i encoded.txt -o decoded.txt --base64 --decode

TOML and XML conversions are inferred from input and output file extensions.

Key-value text to JSON

Convert .env-style KEY=value text, including values containing additional equals signs:

bash
codewise encode kvtj --file .env --output env.json
codewise encode kvtj --file .env --print
FlagShortDescription
--file-fInput key-value file (required)
--output-oOutput path; defaults to output.json
--print-pPrint JSON instead of writing a file

Released under the MIT License.