mirror of
https://github.com/nushell/nushell.git
synced 2024-12-03 05:44:09 +01:00
35 lines
692 B
Markdown
35 lines
692 B
Markdown
---
|
|
title: to json
|
|
layout: command
|
|
version: 0.59.1
|
|
---
|
|
|
|
Converts table data into JSON text.
|
|
|
|
## Signature
|
|
|
|
```> to json --raw --indent --tabs```
|
|
|
|
## Parameters
|
|
|
|
- `--raw`: remove all of the whitespace
|
|
- `--indent {number}`: specify indentation width
|
|
- `--tabs {number}`: specify indentation tab quantity
|
|
|
|
## Examples
|
|
|
|
Outputs a JSON string, with default indentation, representing the contents of this table
|
|
```shell
|
|
> [a b c] | to json
|
|
```
|
|
|
|
Outputs a JSON string, with 4-space indentation, representing the contents of this table
|
|
```shell
|
|
> [Joe Bob Sam] | to json -i 4
|
|
```
|
|
|
|
Outputs an unformatted JSON string representing the contents of this table
|
|
```shell
|
|
> [1 2 3] | to json -r
|
|
```
|