# libtmux.query.encode_json

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Lua
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lua/blob/d68f829fe097e38dcbbf7147e276666fe615f0cf/lua/libtmux/query.lua#L15
- **Page:** https://libtmux.org/en/lua/v0.1.1/reference/libtmux-query-encode_json/

```
encode_json: fun(
  schema: libtmux.QuerySchema,
  criteria: libtmux.Where,
  codec: table,
):string?, libtmux.QueryError?
```

Encode this Lua API's versioned JSON profile using an explicit consumer codec.

## Parameters

- `schema` (`libtmux.QuerySchema`)
- `criteria` (`libtmux.Where`)
- `codec` (`table`): A trusted lunajson-compatible encoder and SAX parser.

## Guides

Pages that discuss `encode_json`.

- [Query captured data](/en/lua/v0.1.1/guides/query/)
