Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

list of hashes does not work #19

Open
piranha opened this issue Apr 30, 2011 · 6 comments
Open

list of hashes does not work #19

piranha opened this issue Apr 30, 2011 · 6 comments

Comments

@piranha
Copy link

piranha commented Apr 30, 2011

This data is not parsed properly:

  - a: 1
    b: 2
  - a: 3
    b: 4
@puzrin
Copy link

puzrin commented May 9, 2011

Seems your example is invalid. This one works fine:

- l1:
  a: 1
  b: 2
- l2:
  a: 1
  b: 2

@piranha
Copy link
Author

piranha commented May 9, 2011

This is two different cases. In your case it's a list of dictionaries of dictionaries (with wrong indent), in my case it's a list of dictionaries. Python's yaml does it right:

>>> a = '''
... - a: 1
...   b: 2
... '''
>>> b = '''
... - l1:
...   a: 1
...   b: 2
... '''
>>> c = '''
... - l1:
...     a: 1
...     b: 2
... '''
>>> yaml.load(a)
    [{'a': 1, 'b': 2}]
>>> yaml.load(b)
    [{'a': 1, 'b': 2, 'l1': None}]
>>> yaml.load(c)
    [{'l1': {'a': 1, 'b': 2}}]

@puzrin
Copy link

puzrin commented May 9, 2011

---
  -
    a: 1
    b: 2
  -
    a: 3
    b: 4

=>

[ { a: 1, b: 2 }, { a: 3, b: 4 } ]

?

@piranha
Copy link
Author

piranha commented May 9, 2011

Nice! So basically it almost works. Back to debugging, not sure though if I can fix that easily. :\

@piranha
Copy link
Author

piranha commented Jun 1, 2011

This is fixed in vadimon/js-yaml@32d8e3a1860299c83bf9b08c4aee907660431680. Can it be merged please?

@puzrin
Copy link

puzrin commented Jun 11, 2011

+1

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

No branches or pull requests

2 participants