4 ms·
Why oh why... If it helps JSON invade the enterprise then ok, but why make a good thing bad.
by drawkbox 16y ago
Why oh why... If it helps JSON invade the enterprise then ok, but why make a good thing bad.
- gte910h 16y agohttp://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=/xs40/convertingbetweenjsonandjsonx05.htm http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/inde... To allow you to use XSLT tools apparently.
- ericmoritz 16y agoXSLT and XPath is about the only reason I can see to use this. But, you know, how hard is: x.person.addresses[0].city? I guess XPath is easier when you probably have to do something like this: JSONObject json = (JSONObject) JSONSerializer.toJSON( jsonTxt ) String city = json.getJSONObject("person").getJSONArray("addresses").getJSONObject(0).getJSONObject("city"); Or however you'd do it in Java.
- wulczer 16y agoThat's not hard, what's hard is //person[@alive="true"]/pets//dog[@hair="long"]/*/flea[@name]
- deleted 16y ago[deleted]
- catshirt 16y agostill, i think an xpath evaluator for json would have been the way to go here instead
- Stormbringer 16y agoYou appear to be confusing Java and Javascript. JSON stands for Javascript Object Notation. In Java the equivalent would simply be serialization. NB: if XSLT and XPath is the solution, you've already lost.
- gte910h 16y agoJSON is used for far far more than javascript these days. It's a far better communication protocol than XML for most things.
- mikeryan 16y ago"Some people, when confronted with a problem, think 'I know, I'll XSLT.' Now they have two problems." (edited for relevance)
- amalcon 16y agoThis is actually one of the few things XML is very good at: embedding a document within another document. I mean, it's not something you'd want to use all over the place, but there are situations where it might come in handy.