Skip to content

Instantly share code, notes, and snippets.

@ericlee996
ericlee996 / HelloYaml.yaml
Created September 10, 2012 00:56
Simple YAML example
development:
adapter: mysql
database: project_development
username: root
password:
socket: /tmp/mysql.sock
@ericlee996
ericlee996 / HelloYaml.java
Created September 10, 2012 00:52
Simple SnakeYAML example
public class HelloYaml {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws FileNotFoundException {
Yaml yaml = new Yaml();
System.out.println(yaml.dump(yaml.load(new FileInputStream(new File(
"hello_world.yaml")))));
Map<String, Map<String, String>> values = (Map<String, Map<String, String>>) yaml
.load(new FileInputStream(new File("hello_world.yaml")));