Home Explore Blog CI



nushell

commands/docs/from_yml.md
89324500c22b07634381849e3303431fb889bcc81c85bd820000000300000500
---
title: from yml
categories: |
  formats
version: 0.104.0
formats: |
  Parse text as .yaml/.yml and create table.
usage: |
  Parse text as .yaml/.yml and create table.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `from yml` for [formats](/commands/categories/formats.md)

<div class='command-title'>Parse text as .yaml&amp;#x2f;.yml and create table.</div>

## Signature

```> from yml {flags} ```


## Input/output types:

| input  | output |
| ------ | ------ |
| string | any    |
## Examples

Converts yaml formatted string to table
```nu
> 'a: 1' | from yaml
╭───┬───╮
│ a │ 1 │
╰───┴───╯
```

Converts yaml formatted string to table
```nu
> '[ a: 1, b: [1, 2] ]' | from yaml
╭───┬────┬───────────╮
│ # │ a  │     b     │
├───┼────┼───────────┤
│ 0 │  1 │    ❎     │
│ 1 │ ❎ │ ╭───┬───╮ │
│   │    │ │ 0 │ 1 │ │
│   │    │ │ 1 │ 2 │ │
│   │    │ ╰───┴───╯ │
╰───┴────┴───────────╯

```

Chunks
e625ae39 (1st chunk of `commands/docs/from_yml.md`)
Title: from yml command
Summary
The `from yml` command is designed to parse text formatted as YAML (.yaml or .yml files) and convert it into a structured table within Nushell. This command is part of the formats category, specifically dealing with data conversion. It takes a string as input, which should contain valid YAML data, and outputs a table representing the parsed YAML structure. The command can handle simple key-value pairs as well as nested structures like lists and dictionaries. The output table allows users to easily query and manipulate the data using Nushell's powerful command-line tools. Error handling is implicit, meaning invalid YAML input may lead to unexpected results or errors during parsing. Examples show how to convert a simple YAML string into a table with columns representing keys and rows representing values, and how nested structures are represented in the output table. The editLink and contributors flags are disabled for this command.