Home & blog  /  2010  /  Dec  /

posted: 02 Dec '10 18:55 tags: XML, JSON, remap, convert, data, AJAX, jQuery

I've had a great response to my XML-to-JSON convertor and remapper. Its ability to not only convert but also remap data on the fly, to your precise structural requirements, has gone down particularly well.

One flaw raised today, though, was that it didn't work with RSS fees. Standard XML feeds, yes, but not RSS. After some digging I realised why.

The plugin expected the iteration node (i.e. the repeated node whose data will form the sub-objects of your JSON data) to directly follow the root node, e.g.

1

2    

3         foo

4         bar.html

5    

6

But if your XML had more levels - such as the following, typical of RSS:

1

2    

3        

4             foo

5             bar.html

6        

7    

8

...it didn't play ball. This has been countered by the addition of a new second argument when calling the plugin, in which you pass a space-separated selector string matching the iteration node, so for the above two examples this would be 'root news_story' and 'rss channel news_story', respectively.

Happy days! to download, get usage info or view a demo.

I've also been asked about whether the plugin supports XML node attributes. No, but it will. Stay posted...

older posts >