• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

JSONObject from two packages

 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I am trying to use JSON in my project i am seeing that JSONObject can be from two packages .




Please tell me what is the difference between them
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you have two JSOn libraries in your classpath. Which one were you intending to use?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya


I have two versions of jar files :
json-lib-2.2.2-jdk15 and json.jar

Please let me know what is standard one .
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Neither, they are two implementations of the same thing. You just need to decide which you want to use.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you .

I would like to go for json.jar.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ravi Kiran Va wrote:Hi ,
I am trying to use JSON in my project i am seeing that JSONObject can be from two packages .




Please tell me what is the difference between them



hi i want to know how to convert xml file to json object

please see the following code

import net.sf.json.JSON;
import net.sf.json.xml.XMLSerializer;

import org.apache.commons.io.IOUtils;
import java.io.*;
import org.json.XML;

import org.apache.commons.io.IOUtils;
import java.io.*;
import org.json.XML;

class ConvertJson {

public static void main(String[] args) throws Exception {
InputStream is = new FileInputStream(new File("C:\\Documents and Settings\\JA0084604\\Desktop\\NMS\\XO-OpenNMS\\build.xml"));
String xml = IOUtils.toString(is);

// XMLSerializer xmlSerializer = new XMLSerializer();
JsonObject jsonObject=new JsonObject();

jsonObject = XML.toJSONObject( xml );
System.out.println( json.toString(2) );
}
}

for this actually i don't have jars org.json.xml.
please let me these code is enough to get json object.
and in program how to find out there is specific jars are needed.
because i am getting error only can't find symbol with following classname.
 
I am mighty! And this is a mighty small ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic