Spec-Zone.ru › Nushell

from json for formats

Convert JSON text into structured data.

Signature

> from json {flags}

Flags

  • --objects, -o: Treat each line as a separate value.
  • --strict, -s: Follow the json specification exactly.

Input/output types:

input output
string any

Examples

Converts json formatted string to table.

> '{ "a": 1 }' | from json
╭───┬───╮
│ a │ 1 │
╰───┴───╯

Converts json formatted string to table.

> '{ "a": 1, "b": [1, 2] }' | from json
╭───┬───────────╮
│ a │ 1         │
│   │ ╭───┬───╮ │
│ b │ │ 0 │ 1 │ │
│   │ │ 1 │ 2 │ │
│   │ ╰───┴───╯ │
╰───┴───────────╯

Parse json strictly which will error on comments and trailing commas.

> '{ "a": 1, "b": 2 }' | from json -s
╭───┬───╮
│ a │ 1 │
│ b │ 2 │
╰───┴───╯

Parse a stream of line-delimited JSON values.

> '{ "a": 1 }
{ "b": 2 }' | from json --objects
╭───┬────┬────╮
│ # │ a  │ b  │
├───┼────┼────┤
│ 0 │  1 │ ❎ │
│ 1 │ ❎ │  2 │
╰───┴────┴────╯

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/from_json.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API