# JsonSaveOptions Interface

> JsonSaveOptions interface in the Node.js TypeScript API: JSON imports accept arrays of records or arrays of rows. Export defaults to records.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Interface
- **Path:** TX Sheet Control > API Reference > TypeScript API > Node.js Server > JsonSaveOptions Interface
- **822 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/llms-full.txt

---

JSON imports accept arrays of records or arrays of rows. Export defaults to records.

Package: `@txtextcontrol/tx-sheet-control-server`. Version: **2.0.0**.

Type-only declaration; it is not a JavaScript runtime constructor.

### Members

#### Properties

| Property | Description |
|---|---|
| [format](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/format-property/llms-full.txt) | Records use header names as keys; rows retain all selected rows as arrays. Default records. |
| [hasHeaderRow](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/hasheaderrow-property/llms-full.txt) | For JSON records and XML, use the first selected row as field names. Default true; false generates Column1, etc. |
| [maxCells](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/maxcells-property/llms-full.txt) | Maximum selected rectangular cell count, including blanks. Defaults to 1,000,000. |
| [maxFileBytes](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/maxfilebytes-property/llms-full.txt) | Maximum encoded output bytes; defaults to 32 MiB. |
| [pretty](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/pretty-property/llms-full.txt) | Indent exported JSON by two spaces. Default false. |
| [range](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/range-property/llms-full.txt) | Inclusive A1 rectangle. Defaults to A1 through the last populated cell; formatting alone does not extend it. |
| [sheetName](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/sheetname-property/llms-full.txt) | Worksheet name; defaults to the active worksheet. |

### Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

```typescript
import type { ServerSheetControl } from '@txtextcontrol/tx-sheet-control-server';
import { StreamType, type JsonSaveOptions } from '@txtextcontrol/tx-sheet-control-server';

async function createJsonSaveOptionsReport(control: ServerSheetControl) {
    const book = control.workbook;
    const sheet = book.sheets.at(0);
    sheet.range('A1:C2').setValues([
        ['Customer', 'Amount', 'Total'],
        ['Müller', 125.5, null],
    ]);

    sheet.cell('C2').setFormula('=B2*1.19');

    const options: JsonSaveOptions = {
        sheetName: 'Sheet1',
        range: 'A1:C2',
        hasHeaderRow: true,
        maxCells: 10000,
        maxFileBytes: 1048576,
        format: 'records',
        pretty: true,
    };

    return await book.save(StreamType.JSON, options);
}
```

### See Also

- [TypeScript Node.js Server API](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/llms-full.txt)
- [CSV, XML and JSON Data](https://docs.textcontrol.com/tx-sheet-control/document-processing/tabular-data/llms-full.txt)

---

## In This Section

- [JsonSaveOptions.format Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/format-property/llms-full.txt): JsonSaveOptions.format property in the TX Sheet Control TypeScript API for Node.js: Records use header names as keys; rows retain all selected rows as arrays.
- [JsonSaveOptions.hasHeaderRow Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/hasheaderrow-property/llms-full.txt): JsonSaveOptions.hasHeaderRow property in the TX Sheet Control TypeScript API for Node.js: For JSON records and XML, use the first selected row as field names.
- [JsonSaveOptions.maxCells Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/maxcells-property/llms-full.txt): JsonSaveOptions.maxCells property in the TX Sheet Control TypeScript API for Node.js: Maximum selected rectangular cell count, including blanks.
- [JsonSaveOptions.maxFileBytes Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/maxfilebytes-property/llms-full.txt): JsonSaveOptions.maxFileBytes property in the TX Sheet Control TypeScript API for Node.js: Maximum encoded output bytes; defaults to 32 MiB.
- [JsonSaveOptions.pretty Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/pretty-property/llms-full.txt): JsonSaveOptions.pretty property in the TX Sheet Control TypeScript API for Node.js: Indent exported JSON by two spaces. Default false.
- [JsonSaveOptions.range Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/range-property/llms-full.txt): JsonSaveOptions.range property in the TX Sheet Control TypeScript API for Node.js: Inclusive A1 rectangle. Defaults to A1 through the last populated cell.
- [JsonSaveOptions.sheetName Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/sheetname-property/llms-full.txt): JsonSaveOptions.sheetName property in the TX Sheet Control TypeScript API for Node.js: Worksheet name; defaults to the active worksheet.

---

## Nearby

- **Previous:** [HeaderFooterSettings.scaleWithDocument Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/headerfootersettings/scalewithdocument-property/llms-full.txt)
- **Next:** [JsonSaveOptions.format Property](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/nodejs/jsonsaveoptions/format-property/llms-full.txt)
