• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Iterating over JYAML data - deserialization

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For some reason Im having to work with a yaml file, using JYaml like this:

---
- !tests
dfa:
homepage: "1234212351636"
registration: "35835535"
signup: "37373737"

I can retrieve the file into the following by doing this, but I think this looks a bit expensive:

List<Map<String, String>> out = Yaml.loadType(new File("src/tracking.yml"), ArrayList.class);

Is there any way I can iterate over this? As far as I can tell, its a hashmap within a list.

Also is it possible to just get single values, like all of the numeric values?

Even the header the dfa?

Not much info on the jyaml site, would have preferred to use snakeyaml, but my boss wont allow it

 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used Jyaml so sorry but I can't help you but you could try telling your boss Jyaml is no longer supported and no new releases have been issued since 2007 so maybe it's time to move to something like snakeyaml which is still supported.
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic