Live data from Hacker News

JSONx is an IBM standard format to represent JSON as XML

pic.dhe.ibm.com

61–68 of 68 posts

Re: JSONx is an IBM standard format to represent JSON as XML

#61
post #12

Why?

To use existing XML 1.0 tools on data that comes in as JSON. It may be somewhat problematic that it doesn't actually support all JSON, because the characters that are permitted (even with escapes) in XML 1.0 text do not include all characters that can appear in JSON values, so if you use it on legal JSON that isn't constrained to be XML 1.0 compatible, it will do something wrong (the docs aren't clear on whether it w…

> the characters that are permitted (even with escapes) in XML 1.0 text do not include all characters that can appear in JSON values

Do you have an example of this? I'm curious what character you could have in JSON that you couldn't represent in XML using the '&#' syntax.

Edit: To answer my own question, backspace is an example of such a character.  is not valid XML.

Re: JSONx is an IBM standard format to represent JSON as XML

#62
post #24
post #9

Earlier quoted context omitted.

Yep. The rest of it is, well, xml, and it's not going to be as clean looking as json , but why do I need to see the word json at the start and stop of every element? It could at least be abbreviated to just 'j'? On the plus side I bet the output gzip's up rather nicely in transit assuming you're HTTP GET'ting this data....

> but why do I need to see the word json at the start and stop of every element? Because of what I just mentioned. If they had set the root namespace directly you wouldn't have to declare the namespace prefix on every element.

I don't know why you were downvoted. Setting the root namespace provides exactly the effect of dropping "json:" from everything.

Re: JSONx is an IBM standard format to represent JSON as XML

#64
post #16

And now the next trick I will perform is turning XML into JSON

https://gist.github.com/DavidJFelix/e5f16d4d1f8760bc3b39 buddy of mine made JSHOL on a whim which creates html from json

Sounds like your buddy just inadvertently created the Turducken of data-interchange formats

http://en.wikipedia.org/wiki/Turducken

Re: JSONx is an IBM standard format to represent JSON as XML

#65
post #28
post #18

Earlier quoted context omitted.

But what if the original JSON had a string that looks like XML? Does {"endTag": " "} become ?

They'd probably escape out the angle brackets with entities. Sorry, Bobby Tables.

Probably, well hopefully, sure. But I want to know whether they did, and whether the technique is fragile.

Re: JSONx is an IBM standard format to represent JSON as XML

#66
post #30

Earlier quoted context omitted.

I've never understood the reasoning behind using a textual serialization format that's not human readable. If you don't want it to be readable, make the darn thing binary and go for efficiency.

There's a difference between prioritizing readability and simply being readable.

Please explain the trade off, I can't see myself debugging an unindented XML file without an appropriate reader. Exactly like a binary file.

Re: JSONx is an IBM standard format to represent JSON as XML

#68
post #57

Earlier quoted context omitted.

That doesn't make this mess any saner, if the point was to apply XML tools to JSON, why not convert to an existing XML dialect with equivalent expressive power, e.g. XMLRPC's serialisation format (which provides a strict superset of JSON capabilities (if you include the nil extension))?

The obvious problem being that you might not have control over the source of the data. JSONx means you can apply xml tools to json sources, period.

I'm not sure what you're trying to say. The source of the data is irrelevant, XMLRPC w/ nil (and other pre-existing formats I'm sure) are strict supersets of JSON, any JSON document can be converted back and forth between XMLRPC and JSON without data loss. So XMLRPC (or something else with similar capabilities) would give you exactly the same ability to apply XML tools to "JSON sources".
Post reply on HN