Clone wiki

snakeyaml / Home

Welcome

YAML 1.1 parser and emitter for Java.

Requirements

SnakeYAML requires Java 6 or higher. (The source depends on Java 5, but the build targets Java 6.)

SnakeYAML does not depend on any external library (but the tests do).

Info

Quick start

Loading (de-serialize):

Yaml yaml = new Yaml();
Object obj = yaml.load("a: 1\nb: 2\nc:\n  - aaa\n  - bbb");
System.out.println(obj);

{b=2, c=[aaa, bbb], a=1}

Dumping (serialise):

Map<String, String> map = new HashMap<String, String>();
map.put("name", "Pushkin");
Yaml yaml = new Yaml();
String output = yaml.dump(map);
System.out.println(output);

--- 
name: Pushkin

For more details, please check Documentation

Contribute

The SnakeYAML library is developed by the team of developers and it is based on PyYAML module written by Kirill Simonov.

SnakeYAML is released under the Apache 2.0 license.

Wiki features

This wiki uses the Markdown syntax.

The wiki itself is actually a mercurial repository, which means you can clone it, edit it locally/offline, add images or any other file type, and push it back to us. It will be live immediately.

Go ahead and try:

$ hg clone https://asomov@bitbucket.org/asomov/snakeyaml/wiki

Wiki pages are normal files, with the .md extension. You can edit them locally, as well as creating new ones.

Syntax highlighting

You can also highlight snippets of text (we use the excellent Pygments library).

Here's an example of some Python code:

def wiki_rocks(text):
    formatter = lambda t: "funky"+t
    return formatter(text)

You can check out the source of this page to see how that's done, and make sure to bookmark the vast library of Pygment lexers, we accept the 'short name' or the 'mimetype' of anything in there.

Have fun!

Updated