Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

from json for formats

Convert from json to 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:

inputoutput
stringany

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 │
╰───┴────┴────╯