
JSONx is an IBM standard format to represent JSON as XML - yaph
http://pic.dhe.ibm.com/infocenter/wsdatap/v6r0m0/index.jsp?topic=%2Fcom.ibm.dp.xm.doc%2Fjson_jsonx.html
======
namecast
From the department-of-redundancy-department....

The output syntax is even more glorious than you'd think:

<?xml version="1.0" encoding="UTF-8"?> <json:object
xsi:schemaLocation="[http://www.datapower.com/schemas/json](http://www.datapower.com/schemas/json)
jsonx.xsd" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-
instance"](http://www.w3.org/2001/XMLSchema-instance")
xmlns:json="[http://www.ibm.com/xmlns/prod/2009/jsonx">](http://www.ibm.com/xmlns/prod/2009/jsonx">)
<json:string name="name">John Smith</json:string> <json:object name="address">
<json:string name="streetAddress">21 2nd Street</json:string> <json:string
name="city">New York</json:string> <json:string name="state">NY</json:string>
<json:number name="postalCode">10021</json:number> </json:object> <json:array
name="phoneNumbers"> <json:string>212 555-1111</json:string> <json:string>212
555-2222</json:string> </json:array> <json:null name="additionalInfo" />
<json:boolean name="remote">false</json:boolean> <json:number
name="height">62.4</json:number> <json:string name="ficoScore"> >
640</json:string> </json:object>

...and no, I'm not joking, and don't call me Shirley.

~~~
sp332
But what if the original JSON had a string that looks like XML? Does
{"endTag": "</json:string>"} become <json:string> </json:string>
</json:string> ?

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

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

------
dyoo1979
Wait, this can't be right for purely technical reasons: what would this to do
a string containing vertical tab characters?

Such strings are illegal in XML. I see nothing in the "JSONx Conversion Rules"
that addresses the problem that the strings representable in XML are a smaller
set than those in JSON.

[edit] Yup, confirmed. The documentation says: "The \b (backspace) and the \f
(form feed) characters are not supported in XML and, subsequently, are not
supported in JSONx." So not only does this JSON->XML thing seem obtuse, but
it's partial.

I wrote a rant about this point a few days ago. Seems more well timed than I
had hoped.
[https://plus.google.com/117593568781545916065/posts/ViNzo5Jj...](https://plus.google.com/117593568781545916065/posts/ViNzo5JjbRf)

~~~
dragonwriter
> So not only does this JSON->XML thing seem obtuse, but it's partial.

If it wasn't partial, it would be useful -- allowing existing XML tools to
easily consume and/or produce JSON tools by applying a JSON -> XML on input
and/or XML -> JSON on output _would_ be valuable.

But when the conversion is restricted to an XML-1.0-compatible-subset of JSON,
the value drops considerably.

------
laydros
I worked on the Datapower team soon after IBM acquired the product. Its a very
cool device.

But I read the headline and threw up in my mouth a little.

------
edwingustafson
Most likely they developed this format to store JSON in DB2 or to manipulate
JSON with existing XML-based tools.

~~~
the_mitsuhiko
That's exactly what this is:
[http://www.ibm.com/developerworks/library/x-db2JSONpt1/](http://www.ibm.com/developerworks/library/x-db2JSONpt1/)

------
thrush
This is SO SO important. I've had to convert JSON to XML and vice versa so
many times in order to transfer data to and from legacy code components. No, I
don't think an ideal world involves any sort of communication where one side
speaks JSON and the other speaks XML, but the current world very much needs a
standardization like this.

~~~
dragonwriter
Insofar as the world needs a JSON->XML conversion standard, it needs one that
handles all legal JSON, which this doesn't (it could if it used the same
approach to target XML 1.1 instead of XML 1.0, or it could if it used a
slightly more complex representation of JSON strings in the XML 1.0, but
instead it chose to be a conversion for a restricted XML-1.0-friendly subset
of JSON.)

------
lovelearning
They missed a golden chance to name it "Enterprise JSON".

------
peterwwillis
What, is this supposed to be funny? _You_ try converting completely different
formats into one another without a standard, and see the kinds of fucked up
bug reports you get.

------
valarauca1
WebSphere! Experience everything wrong with Enterprise Software Development
for the simple price of $100,000 per seat, per core, per year :D

------
JonnieCache
Oh _good,_ you can convert it back to JSON with an XSLT.

~~~
drivingmenuts
I just had a flashback.

XSLT really is the seventh circle of Hell.

------
powdahound
Reminds me of the "JSON Encodings for XMPP" specification. :)
[http://xmpp.org/extensions/xep-0295.html](http://xmpp.org/extensions/xep-0295.html)

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

~~~
OhhHeyTyler
[https://gist.github.com/DavidJFelix/e5f16d4d1f8760bc3b39](https://gist.github.com/DavidJFelix/e5f16d4d1f8760bc3b39)

buddy of mine made JSHOL on a whim which creates html from json

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

[http://en.wikipedia.org/wiki/Turducken](http://en.wikipedia.org/wiki/Turducken)

------
DonHopkins
Does it support EBCDICTF8 (Extended Binary Coded Decimal Interchange Code
Transformation Format Eight) for encoding Unicode as 8 bit EBCDIC?

------
kra34
but where can you buy their complicator gloves?

~~~
CamperBob2
You get a free pair with every turboencabulator purchase.

~~~
ribs
With panadermic semi-boloid slots? (Fully boloid slots require a macroflanging
compensator, and who's got the money)

~~~
linker3000
Is it a per-slot licence model?

------
marcofiset
Wait.... what ?

------
angersock
Well, they _did_ get a license from Crockford to use JSON for evil, so mission
accomplished I guess?

------
neilellis
They killed a 1000 unicorns to make this you know.

I can hear the screams in my sleep.

------
kevinSuttle
How recent is the introduction of this format interchange?

------
easytiger
April Fools?

------
dapatil
Why?

------
kttmrt
Why?

~~~
dragonwriter
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 will fail or just drop
the offending characters), so the only place that it seems safe to use is in a
constrained internal environment where you control "JSON" to mean "JSON using
XML-1.0-safe characters".

~~~
papercrane
> 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.
&#8; is not valid XML.

------
jmsduran
This does not surprise me one bit, I'm pretty sure IBM holds a patent for this
somehow.

------
unclebunkers
What is this for?

------
pedrospdc
This should not be used anywhere, never.

------
dreamweapon
"The horror... the horror!"

