Hacker News new | ask | show | jobs
by KnobbleMcKnees 1007 days ago
No you've misunderstood my point. This doesn't work for cases where one child is in fact a property that is a complex object.

XML claims to solve the problem of attributes vs children but then falls short at the first hurdle by not discerning between a single complex object as an attribute and an array of complex objects as children.

JSON and YAML do not have this problem as they are explicit in their representation.

YAML example:

    parent:
        child: name
vs

    parent:
      - child: name
Try converting each of these to JSON. The former will give you an object property called child, the latter will give you an array property called child with one element
1 comments

I'm not sure about that - I think your second example will parse to "parent": [{"child": "name"}] in JSON
Yeah this was what I was going for, same point stands