OLD | NEW |
1 A parser for [YAML](http://www.yaml.org/). | 1 A parser for [YAML](http://www.yaml.org/). |
2 | 2 |
3 Use `loadYaml` to load a single document, or `loadYamlStream` to load a | 3 Use `loadYaml` to load a single document, or `loadYamlStream` to load a |
4 stream of documents. For example: | 4 stream of documents. For example: |
5 | 5 |
6 ```dart | 6 ```dart |
7 import 'package:yaml/yaml.dart'; | 7 import 'package:yaml/yaml.dart'; |
8 | 8 |
9 main() { | 9 main() { |
10 var doc = loadYaml("YAML: YAML Ain't Markup Language"); | 10 var doc = loadYaml("YAML: YAML Ain't Markup Language"); |
11 print(doc['YAML']); | 11 print(doc['YAML']); |
12 } | 12 } |
13 ``` | 13 ``` |
14 | 14 |
15 This library currently doesn't support dumping to YAML. You should use | 15 This library currently doesn't support dumping to YAML. You should use |
16 `JSON.encode` from `dart:convert` instead: | 16 `JSON.encode` from `dart:convert` instead: |
17 | 17 |
18 ```dart | 18 ```dart |
19 import 'dart:convert'; | 19 import 'dart:convert'; |
20 import 'package:yaml/yaml.dart'; | 20 import 'package:yaml/yaml.dart'; |
21 | 21 |
22 main() { | 22 main() { |
23 var doc = loadYaml("YAML: YAML Ain't Markup Language"); | 23 var doc = loadYaml("YAML: YAML Ain't Markup Language"); |
24 print(JSON.encode(doc)); | 24 print(JSON.encode(doc)); |
25 } | 25 } |
26 ``` | 26 ``` |
27 | |
28 The source code for this package is at <http://code.google.com/p/dart>. | |
29 Please file issues at <http://dartbug.com>. Other questions or comments can be | |
30 directed to the Dart mailing list at <mailto:misc@dartlang.org>. | |
OLD | NEW |