---
url: /process-functions/table-fields.md
description: Lists the fields of a table in the model.
---

# table.fields

Lists the fields of one of the model's [tables](/technical/tables).

::: tip
For more control, such as other column types, indexes or keys, manage tables with SQL instead. Run `CREATE`, `ALTER` and `DROP TABLE` statements with [DatasourceClient](/process-functions/datasourceclient)'s `execute`.
:::

```js
table.fields(tableName)
```

## Parameters

| Parameter | Type | Description |
|---|---|---|
| `tableName` | `string` | The table's name or id. |

## Returns

The fields, as a JSON array string, each with its id, name and type. Use `JSON.parse()` to read it. Returns `null` when the table can't be found.

## Examples

```js
const fields = JSON.parse(table.fields("users"));
```

## Related

* [table.fieldAdd](/process-functions/table-fieldadd)
* [table.fieldExists](/process-functions/table-fieldexists)
