• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

JSON in Java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Soumya Maitra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic