File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes JSON in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JSON in Java" Watch "JSON in Java" New topic
Author

JSON in Java

Soumya Maitra
Greenhorn

Joined: Aug 03, 2012
Posts: 2
Hi all and gurus

I am really new to Java world. Just joined the forum 2 min back.
Basically I come form Mac iOS development expanding my skill sets to Java/Android domain also.
I dont know whether this is the correct place in the forum to post my question or not let me try mine.

I am writing a JSON service that will parse JSON and return me a JSON object or an array whatever possible.
Can any one guide me to the correct way to it?

I did some R&D making it up to a successful call to Network as..................
Can you look at if error handling and garbage collection ( in method finalize () & clearGarbage() ) is alright?
Please guide




Regards
Soumya
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

You need not worry about garbage collection, but yes you should close all the resources which you open like FileReaders, network connections and so on. And dont rely on finalizers to do your garbage collection activity.

Then in your code you are not doing anything JSONish, I just see you are obtaining some data from a URL. For reading JSON or creating JSON have a look at GSON library. You would have to download the JAR and then add it to your classpath and use the APIs therein to parse/create JSON.


Mohamed Sanaulla | My Blog
Soumya Maitra
Greenhorn

Joined: Aug 03, 2012
Posts: 2
Thanks Mohamed Sanaulla,

It was really appreciable that you come across to solve my problem .

I will try your solution and revert.
Mohamed Sanaulla wrote: For reading JSON or creating JSON have a look at GSON library. You would have to download the JAR and then add it to your classpath and use the APIs therein to parse/create JSON.


Thanks anyway.

Regards
Soumya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSON in Java