Live data from Hacker News

JSONx is an IBM standard format to represent JSON as XML

pic.dhe.ibm.com

31–40 of 68 posts

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

#31
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.

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

#34
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....

Replace `xmlns:json=" http://...` with `xmlns:j=" http://...` .

Actually, just remove the colon and the prefix entirely. It becomes surprisingly readable:

    
        John Smith
        
            21 2nd Street
            New York
            NY
            10021
        
        
            212 555-1111
            212 555-2222
        
        
        false
        62.4
         > 640
    

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

#35
post #2

From the department-of-redundancy-department.... The output syntax is even more glorious than you'd think: http://www.datapower.com/schemas/json jsonx.xsd" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:json=" " rel="nofollow">http://www.ibm.com/xmlns/prod/2009/jsonx"> John Smith 21 2nd Street New York NY 10021 212 555-1111 212 555-2222 false 62.4 > 640 ...and no, I'm not joking, and don't call me Shirl…

The xml namespace descriptors are bulky. The rest looks efficient, for xml, and almost readable with some indentation.

  
  
    John Smith
    
      21 2nd Street
      New York
      NY
      10021
    
    
      212 555-1111
      212 555-2222
    
    
    false
    62.4
     > 640
  
translated (by hand) into JSON gives

  {
    "name": "John Smith",
    "address": { "streetAddress": "21 2nd Street",
                 "city": "New York",
                 "state": "NY",
                 "postalCode": 10021
               },
    "phoneNumbers": ["212 555-1111", "212 555-2222"],
    "additionalInfo": null,
    "remote": false,
    "height": 62.4,
    "ficoScore": " > 640"
  }
Post reply on HN