I don't see what you're getting at. First of all, how is example 1 better than example 2? And how does that prove that JSON is better for functional data while XML is better for imperative data?
<Foo1 name="foo1">
<Bar1 name="bar1"/>
</Foo1>
<Foo2 name="foo2">
<Bar2 name="bar2"/>
</Foo2>
[["Foo1", {"name" : "foo1"}, [
["Bar1", {"name" : "bar1" }]
],
["Foo2", {"name" : "foo2"}, [
["Bar2", {"name" : "bar2" }]
]]
I personally wouldn't do this, but the arbitrary encodings between the two samples are now equivalent.Plus, serialization to JSON in a dynamically-typed language is pretty much automagic compared to what you have to do with XML.