Closed GoogleCodeExporter closed 9 years ago
Hmm... It is interesting idea. Thanks! I'll think about it.
Original comment by abdulla....@gmail.com
on 11 Oct 2013 at 9:32
And Thank you! I forgot :)
Love this lib.
Will just stroll down the "old" _asArray-road for now. NP!
Inspiration could by the way be found here (in actionscript):
http://krasimirtsonev.com/blog/article/as3-action-script-convert-xml-to-json-xml
2json
Original comment by jmj.bak...@gmail.com
on 11 Oct 2013 at 9:48
I've just added a new feature to v1.1.3
(You always can look it at
https://code.google.com/p/x2js/source/browse/xml2json.js or download from
https://x2js.googlecode.com/hg/xml2json.js)
You can do now like this, for your example:
var x2js = new X2JS({
arrayAccessFormPaths : ["json.setup.templates.template", "json.setup.templates.template.states.state"]
});
var json = x2js.xml2json(xmldoc);
And access like the other JS objs:
json.setup.templates.template[0].states.state
You can specify also paths to arrays as RegEx form:
var x2js = new X2JS({
arrayAccessFormPaths : [/.*\.template/, /.*\.state/]
});
Let me know if it works for you! Thanks!
Original comment by abdulla....@gmail.com
on 12 Oct 2013 at 11:11
Also if you need some powerful XPath like tool on JSon there some additional
libraries.
For example I've just googled it - http://goessner.net/articles/JsonPath/ :)
Original comment by abdulla....@gmail.com
on 12 Oct 2013 at 11:36
[deleted comment]
Perfect! Nothing less.
Rewrote my project to use the arrayAccessFormPath and it simply worked.
Thank you!
Haven't tested the json xpath yet. But I sure will.
Original comment by jmj.bak...@gmail.com
on 14 Oct 2013 at 8:32
I appreciate for your feedback and interest! Thank you!
Well, I'm closing this one for now then.
Original comment by abdulla....@gmail.com
on 14 Oct 2013 at 8:38
Original issue reported on code.google.com by
jmj.bak...@gmail.com
on 11 Oct 2013 at 9:11