# JSONValue.encode(to:)

- **Module:** JSONValue
- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-swift/blob/f02a4668570e1cc5198c941413750e021f42c214/Sources/LibTmuxMCP/JSONValue.swift#L38
- **Page:** https://libtmux.org/reference/swift/jsonvalue-encode(to-)/

```
JSONValue.encode(to:)(to: any Encoder) -> ()
```

Encodes this value into the given encoder.

If the value fails to encode anything, `encoder` will encode an empty
keyed container in its place.

This function throws an error if any values are invalid for the given
encoder's format.

- Parameter encoder: The encoder to write data to.
