# Convert workspace files

Source: https://libtmux.org/en/csharp/latest/workspace/cli/convert/

> Convert a complete workspace document between YAML and JSON.

Convert a complete workspace document between YAML and JSON. Conversion
preserves mapping fields; it does not establish that every field can be loaded.

## Inspect the result

Start with [`workspace.yaml`](https://libtmux.org/en/csharp/latest/workspace/guides/installation/#create-the-input) from the [installation
walkthrough](https://libtmux.org/en/csharp/latest/workspace/guides/installation/):

```console
$ tmux-workspace convert --json workspace.yaml
```

Without a destination, machine mode returns the converted document in its
result. YAML comments and textual formatting do not survive conversion to JSON.

## Save a file

Choose an explicit destination and encoding:

```console
$ tmux-workspace convert \
    --json \
    --workspace-format json \
    --save-to workspace.json \
    workspace.yaml
```

Replacing an existing destination requires `--force`. Keep that choice separate
from `--yes`, which answers prompts. Review the result before [loading
it](https://libtmux.org/en/csharp/latest/workspace/cli/load/).

[CLI source](https://github.com/libtmux/libtmux-dotnet/blob/f77fe776ba67a04abb20ddbbc26cf4a000d63b74/src/LibTmux.Workspace.Cli/README.md).
