Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deserialize yaml map? #26

Open
yolkhovyy opened this issue Jan 22, 2019 · 1 comment
Open

How to deserialize yaml map? #26

yolkhovyy opened this issue Jan 22, 2019 · 1 comment

Comments

@yolkhovyy
Copy link

yolkhovyy commented Jan 22, 2019

I am looking for a way of how to deserialize a yaml file like these one (a map):

key0:
  type: Foo
  connection:
    type: 1

key1:
  type: Bar
  connection:
    type: 2

into a map<key, object> without having a "root" property like:

root:
  key0:
    type: Foo
    connection:
      type: 1

  key1:
    type: Bar
    connection:
      type: 2

- would it be possible?

Thank you!

@joeconwaystk
Copy link
Contributor

There isn't a way to have a top-level, arbitrary key map. I'm not sure what the data structure in Dart code would be - its a Map, but Configuration isn't a map. You can load the YAML manually, iterate over each key and instantiate your Configuration for each value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants