# Convert workspace files

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

> Convert a complete workspace document between YAML and JSON.

**Workspace Manager concept example** A working example of the core library. It can change without notice.



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/ts/latest/workspace/guides/installation/#create-the-input) from the [installation
walkthrough](https://libtmux.org/en/ts/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/ts/latest/workspace/cli/load/).

[CLI source](https://github.com/libtmux/libtmux-ts/blob/f36d692552bb9a373b45338bb5fece854e57cc3d/packages/workspace-cli/README.md).
