---
title: "@std/yaml"
description: "Parsing and serializing of YAML files"
jsr: jsr:@std/yaml
pkg: yaml
version: 1.0.12
generated: true
stability: stable
---
<!-- Autogenerated from JSR docs. Do not edit directly. -->

## Overview

<p><a href="https://jsr.io/@std/yaml@1.0.12/doc/~/parse" rel="nofollow"><code>parse</code></a> and <a href="https://jsr.io/@std/yaml@1.0.12/doc/~/stringify" rel="nofollow"><code>stringify</code></a> for handling
<a href="https://yaml.org/" rel="nofollow">YAML</a> encoded data.</p>
<p>Ported from
<a href="https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da" rel="nofollow">js-yaml v3.13.1</a>.</p>
<p>Use <a href="https://jsr.io/@std/yaml@1.0.12/doc/~/parseAll" rel="nofollow"><code>parseAll</code></a> for parsing multiple documents in a single YAML
string.</p>
<p>This package generally supports
<a href="https://yaml.org/spec/1.2.2/" rel="nofollow">YAML 1.2.x</a> (latest) and some
<a href="https://yaml.org/spec/1.1/current.html" rel="nofollow">YAML 1.1</a> features that are
commonly used in the wild.</p>
<p>Supported YAML 1.1 features include:</p>
<ul>
<li><a href="https://yaml.org/type/merge.html" rel="nofollow">Merge</a> type (<code>&lt;&lt;</code> symbol)</li>
</ul>
<p>Unsupported YAML 1.1 features include:</p>
<ul>
<li>Yes, No, On, Off literals for bool type</li>
<li>Sexagesimal numbers (e.g. <code>3:25:45</code>)</li>
</ul>

```js
import { parse, stringify } from "@std/yaml";
import { assertEquals } from "@std/assert";

const data = parse(`
foo: bar
baz:
  - qux
  - quux
`);
assertEquals(data, { foo: "bar", baz: [ "qux", "quux" ] });

const yaml = stringify({ foo: "bar", baz: ["qux", "quux"] });
assertEquals(yaml, `foo: bar
baz:
  - qux
  - quux
`);
```

<h2 id="limitations">
Limitations</h2>
<ul>
<li><code>binary</code> type is currently not stable.</li>
</ul>

### Add to your project

```sh
deno add jsr:@std/yaml
```

<a href="https://jsr.io/@std/yaml/doc" class="docs-cta jsr-cta">See all symbols in @std/yaml on
<svg class="inline ml-1" viewBox="0 0 13 7" aria-hidden="true" height="20"><path d="M0,2h2v-2h7v1h4v4h-2v2h-7v-1h-4" fill="#083344"></path><g fill="#f7df1e"><path d="M1,3h1v1h1v-3h1v4h-3"></path><path d="M5,1h3v1h-2v1h2v3h-3v-1h2v-1h-2"></path><path d="M9,2h3v2h-1v-1h-1v3h-1"></path></g></svg></a>

<!-- custom:start -->
<!-- Add persistent custom content below. This section is preserved across generations. -->

<!-- custom:end -->
