My favorites | Sign in
snakeyaml
YAML parser and emitter for Java
Project Home Downloads Wiki Issues Source
Summary   People
Project Information
  • Project feeds
  • Code license
  • Apache License 2.0
  • Labels
    YAML, Java, parser
Members
    aso...@gmail.com
  • 3 committers
  • 3 contributors
Links
  • Blogs
  • to YAML or not to YAML
  • External links
  • Documentation
  • HOWTO
  • YAML 1.1 Specification
  • Groups
  • For users and developers

YAML 1.1 parser and emitter for Java 5

The art of simplicity is a puzzle of complexity.

Overview

YAML is a data serialization format designed for human readability and interaction with scripting languages.

SnakeYAML is a YAML parser and emitter for the Java programming language.

SnakeYAML features

  • a complete YAML 1.1 parser. In particular, SnakeYAML can parse all examples from the specification.
  • Unicode support including UTF-8/UTF-16 input/output.
  • high-level API for serializing and deserializing native Java objects.
  • support for all types from the YAML types repository.
  • relatively sensible error messages.

Info

  • Documentation
  • JavaDoc
  • Changes
  • Usage
  • How to contribute
  • HOWTO
  • propose or vote for a feature

Requirements

SnakeYAML requires Java 5 or higher.

Download and Installation

The current stable release of SnakeYAML: 1.11.

Download links:

  • source: code.google.com/p/snakeyaml/source/browse/
  • JAR package: repo2.maven.org/maven2/org/yaml/snakeyaml/1.11/snakeyaml-1.11.jar
  • ZIP archive: snakeyaml.googlecode.com/files/SnakeYAML-all-1.11.zip
  • Repository: search.maven.org/#search|ga|1|snakeyaml

Browse 1.10 reports:

  • Maven generated report: snakeyamlrepo.appspot.com/releases/1.10/site/index.html
  • Project's report: snakeyamlrepo.appspot.com/releases/1.10/site/project-reports.html
  • Javadocs: snakeyamlrepo.appspot.com/releases/1.10/site/apidocs/index.html
  • Changes report: snakeyamlrepo.appspot.com/releases/1.10/site/changes-report.html
  • Test coverage report: snakeyamlrepo.appspot.com/releases/1.10/site/cobertura/index.html

Maven 2 configuration:

Repository definition (in settings.xml). Releases are available in the central repository. The latest snapshot is only available in the Sonatype repository.

Snapshots have production quality. They are published only when they meet all the quality criteria for production (all the tests succeed)

<repositories>
  ...
  <repository>
    <id>Sonatype-public</id>
    <name>SnakeYAML repository</name>
    <url>oss.sonatype.org/content/groups/public/</url>
  </repository>
  ...
</repositories>

Dependency definition (in pom.xml)

<dependencies>
  ...
  <dependency>
    <groupId>org.yaml</groupId>
    <artifactId>snakeyaml</artifactId>
    <version>1.12-SNAPSHOT</version>
  </dependency>
  ...
</dependencies>

Documentation

Loading:

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:

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 SnakeYAML Documentation.

Test your YAML document

InstantYAML

Development and bug reports

You may check out the SnakeYAML source code from SnakeYAML Mercurial repository.

You may also browse the SnakeYAML source code.

If you find a bug in SnakeYAML, please file a bug report. You may review open bugs through the list of open issues.

You may discuss SnakeYAML at the mailing list.

General info is here. Feel free to improve the documentation.

Author and copyright

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.

Powered by Google Project Hosting
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.