---
title: table_pretty
description: "Convert arrays or objects to a padded Markdown table."
---

# table_pretty

Convert arrays or objects to a padded Markdown table.

## Syntax

```knap
{{ value | table_pretty }}
{{ value | table_pretty:("Column 1", "Column 2") }}
```

## Usage

- Optional parameters set column headers.
- Columns are padded to equal widths and the separator row expands to match.
- Data shapes and custom headers behave the same as `table`.

## Examples

### Object array

```json title="Data"
{
  "people": [
    {
      "name": "Ada",
      "role": "Engineer"
    },
    {
      "name": "Lin",
      "role": "Designer"
    }
  ]
}
```

```knap title="Template"
{{ people | table_pretty }}
```

```md title="Output"
| name | role     |
| ---- | -------- |
| Ada  | Engineer |
| Lin  | Designer |
```

### Custom columns

```json title="Data"
{
  "values": [
    "Ada",
    "Writer",
    "Lin",
    "Editor"
  ]
}
```

```knap title="Template"
{{ values | table_pretty:("Name", "Role") }}
```

```md title="Output"
| Name | Role   |
| ---- | ------ |
| Ada  | Writer |
| Lin  | Editor |
```

## Related filters

- [table](/filters/table)
