Tag Archives: JSON

JSON In Java. Where Should It Go?

As usual, it’s Saturday night and like the geek I am, I’m here thinking about the weirdest things. Tonight’s question is simple: “If a JSON library was to be integrated into Java SE, where would it go?”

Having worked with PHP a lot in the past year, with respect to the my current open source project KAN CMS, I find the use of AJAX and JSON to very helpful. What more, with PHP’s built in support for JSON parsing and serialization, the whole process is just fun. This got me thinking, what if a JSON library was included in the standard Java SE stack, how useful would it be, and again where would it go?

There is a public JSON library available for download and use over at json.org/java, which I have used it once in a previous mini project. I found it particularly useful although I did not stress test it much, since my application was small. That notwithstanding, with the high number of Web Services that use JSON as a communication format, having a native JSON implementation in the Java SE stack would be very good to help developers easily build small application that consume these services without relying much on third party libraries, although these libraries maybe small.

About packaging, the JSON.org library uses the “org.json.*” package format, so assuming Oracle decided to include that library (or another implementation) in the standard Java, I wonder: “where would they stick it?”

  • java.json.*
  • java.text.json.*
  • java.util.json.*
  • javax.json.*
  • or just keep it in org.json.* with the rest of the strange bunch?

Well, I don’t think this worth loosing sleep over, since Oracle are too busy suing Google’s arse to think about adding new libraries to the currently almost bloatware Java SE, but it certainly is something think about.

Using JSON in Java Swing

After months of working with PHP and AJAX, I finally found time and a reason to go back to Java Swing. This simple application, made at a friend’s request, enables one to determine his/her Ghanaian name based on their date of birth. With all the time I have spent working with PHP and AJAX, I have come to love the JSON data exchange format and I simply could not pass up the opportunity to see how it performs and works with my latest Java Swing incarnation. The application also includes the new Swing Task Dialog component and makes use of the Joda Time API.  Continue reading