IBM's JSONx, or how to represent JSON in XML
-
-
string val = new JSONxDocument(new JSONxObject(new JSONxString("Ticket", "IBM"))).objects[0].elements[0].attributes["Ticker"].GetValue();
-
Words fail me.
-
What. The. Fuck?!
-
dont even remind me. i fucking hate IBM enough already.
-
I dunno. This isn't terrible. Its clearly intended as a piece of glue to make applications that speak json talk to applications that speak xml, and vice versa.
The worrying part is that they've built an entire middleware appliance out of it.
Reminds me. I need to add JSON support to the framework at work.
-
I'm not sure if you can make an application that speaks JSON be understood by an application that speaks XML using this. From what I gathered, you can represent JSON in XML, not translate.
But I agree, it can have some real, practical uses. Though everything I can imagine that might need this is very probably a WTF by itself...
-
That's it, I'm out. I can't do this anymore, going to raise turtles in the Amazon or something less stupid than software.
-
Lets say I have software that can map arbitrary XML formats onto some user-defined structure. No, I'm not kidding. I have 2 or 3 things in my toolbox at work that work EXACTLY like this.
Let's say I have a service that spits out JSON.
I want to plug these together. Apparently I can buy an IBM DataPower Appliance and just kind of do that.
This:
JSONx conversion rules
A DataPower appliance applies rules when converting JSON payloads to JSONx.Says pretty damned clearly that you can convert JSON into this bastard XML representation.
The appliance provides a style sheet that you can use to convert JSONx to JSON.
This says equally clearly that you can do the inverse with an XSLT.
-
I'm drinking vodka and an imperial red ale right now.
I, too, like to combine two bad decisions.
-
That's it, I'm out. I can't do this anymore, going to raise turtles in the Amazon or something less stupid than software.
When jwz got upset that Microsoft ate his shitty browser company's lunch, he quit and bought a nightclub.
-
going to raise turtles in the Amazon
Here I thought you were making a Cloud app to represent the Turtles all the way down theory.
Stupid IT buzzshit
-
I'm not sure if you can make an application that speaks JSON be understood by an application that speaks XML using this. From what I gathered, you can represent JSON in XML, not translate.
There are plenty of programs that speak XML in a generic way. As about the most basic example, imagine one that just presents it graphically as a collapsible tree. I know Chrome & IE does this for XML; I don't know of one that does it for JSON, though probably there is one.. but one easy possibility if you had this around would be to go JSON->XML and then open it in Chrome.
-
Or just use any sane editor with auto format, collapsible trees and JSON support.
-
Or use your favorite browsers's dev tools.
-
This is not enterprisey enough. What we need it an encoding of arbitrary XML into JSON. Then we can start iterating.
-
What we need it an encoding of arbitrary XML into JSON.
{'xml': '<?xml version="1.0" encoding="UTF-8"?>\n<xml>...</xml>'}
-
-
Here's a sample from Wikipedia: JsonML:
["person", {"created":"2006-11-11T19:23", "modified":"2006-12-31T23:59"}, ["firstName", "Robert"], ["lastName", "Smith"], ["address", {"type":"home"}, ["street", "12345 Sixth Ave"], ["city", "Anytown"], ["state", "CA"], ["postalCode", "98765-4321"] ] ]
Doesn't look enterprisey enough…
-
Whether you like it or not, XML has its usages when JSON simply isn't enough. Specially in this M2M communication realm, JSON can be too cumbersome.
With that said, the whole
json:object
andjson:string
tags are simply crap, because from a JSON model you can always infer a proper XML representation (which is not always true the other way around).This makes more sense IMO:
<xml source="json"> <Ticker datatype="string">IBM</Ticker> </xml>
Although I'm not sure if the
source
attribute is legal, this is more related(?) with the real JSON than the proposed by them.
-
https://pbs.twimg.com/media/ByUETcKIIAELf7h.png
No no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no no... just... no.
-
Just wait, eventually someone will need to encode JSONx in JSON
{ "tag": "json:object", "name": "", "value": "", "children": [ { "tag": "json:string", "name": "Ticker", "value": "IBM", "children": [] } ] }
-
Just wait, eventually someone will need to encode JSONx in JSON
Will to live... fading...
-
Did you just write all those "no" or wrote a script for it?
Here, just in case:
while true; do echo -n "no "; done
-
How many times do you have to repeat the conversion before {Ticker: "IBM"} takes more than 1MB to store?
-
dunno. depends if we're just cycling through JSON and JSONX or if other container formats get in the way. it would be interesting to see it formatted in YAML just for S&Gs
-
Did you just write all those "no" or wrote a script for it?
I used the Magic Incantation:
Ctrl+C, Ctrl+V
-
I wrote a stylesheet for converting wddx to json once. Fun times.
-
Here, just in case:
while true; do echo -n "no "; done
Why would you not just write that as
[code]yes no[/code]
?
-
yes
doesn't output on the same line likeecho -n
does.
Filed under: great tools I couldn't live without.
-
Oh fine, use
yes | gawk '{ printf "no " }'
then.
-
-
-
Open Source! Many eyes make bugs shallow! Etc., etc., @blakeyrat
wait, what?
i was just golfing the scriptlet @Eldelshell posted...
-
What does this have to do with open source?
-
If I wanted to use
print
I would have usedprint
-
wait, what?
i was just golfing the scriptlet @Eldelshell posted...
Interesting--parallel development. I saw your ninja edit, btw.
-
What does this have to do with open source?
You made the source available, and others improved it.
-
Interesting--parallel development. I saw your ninja edit, btw.
yeah, i fixed a bug. unfortunatley that added 3 to my score.... hmm.
-
Problem is,
yes
might not be in non-GNU systems, so I win!
-
i'm not out of this yet! (also a *nix like system without yes would be really really odd!)
-
Problem is, yes might not be in non-GNU systems, so I win!
You should write a cmdlet for such situations.
-
Open Source! Many eyes make bugs shallow! Etc., etc., @blakeyrat
What the fuck are you talking about? Why is my name there?
You know what's great about this forum is mouth-foamingly insane people can make little blue notifications pop up on my screen, and then when I click them I get to experience the idiocy first-hand. And of course now by saying that, about 47 assholes are going to just mention my name a thousand times because that's "hilarious".
Look, I'm happy your new straight-jacket fits well, could you please leave me the fuck alone? It's almost time for your electro-shock treatment anyway.
-
@blakeyrat is getting cranky. You need a Snickers, you're becoming a diva.
-
FrostCat:
Open Source! Many eyes make bugs shallow! Etc., etc., @blakeyratWhat the fuck are you talking about? Why is my name there?
I thought you might like to weigh in on Open Source.
You know what's great about this forum is mouth-foamingly insane people can make little blue notifications pop up on my screen, and then when I click them I get to experience the idiocy first-hand.
You're just now realizing this?
-
@Intercourse said:
@blakeyrat is getting cranky. You need a Snickers, you're becoming a diva.
Given how cranky he normally is I wonder who he turns into when he's cranky for him.
-
Next you know IBM will be introducing XMLj: a JSON representation of XML. Then you can thoroughly obfuscate your data with a few translations back and forth!
-
Yo dawg I heard etc etc.
-
I don't have enough legs of nope for this.
-