yaon 1.0.1+2 copy "yaon: ^1.0.1+2" to clipboard
yaon: ^1.0.1+2 copied to clipboard

outdated

A simple library to parse either a string from either yaml or json.

Table of Contents

yaon #

A Dart library that can parse a string encoded as either JSON or YAML into a resulting map or array.

Using the library #

Add the repo to your Dart pubspec.yaml file.

dependencies:
  yaon: <<version>> 

Then run...

dart pub get

Example #

import 'package:yaon/yaon.dart' as yaon;

void main() {
  final inputJson = '''
{
  "foo": "bar",
  "list": [
    1, 2, 3, 5, 8
  ],
  "map": {
    "one": 1,
    "two": 2
  },
  "multiline": "First Line\\nSecond Line\\nThird Line"
}
''';

  final inputYaml = '''
foo: bar
list:
  - 1
  - 2
  - 3
  - 5
  - 8
map:
  one: 1
  two: 2
multiline: |-
  First Line
  Second Line
  Third Line

''';
  var result = yaon.parse(inputJson);
  print(result['map']['one']); // 1

  result = yaon.parse(inputYaml);
  print(result['map']['two']); // 2
}
1
likes
0
pub points
80%
popularity

Publisher

verified publisherpeifferinnovations.com

A simple library to parse either a string from either yaml or json.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

yaml

More

Packages that depend on yaon