Forum Discussion
I am glad you posted an alternate solution to this problem. I will mark this post as resolved now.
Regards,
Marcus
SmartBear Support
I dont see here he is converting json to xml. He still parsing using Jsonsulpher.
//Conversion from json to xml
def jsontoxml;
XMLSerializer xmlSerializer = new XMLSerializer();
JSON json = JSONSerializer.toJSON(parsed_json);
xmlSerializer.setTypeHintsEnabled(false);
jsontoxml = xmlSerializer.write(json);
log.info "JSON Response converted to XML Response Result:" + jsontoxml;
currenlty i have in code where Ready 2.1.0 works. but now when i try to upgrade Ready 2.8.2 i was getting error.
import net.sf.json.JSON
import net.sf.json.JSONSerializer
import net.sf.json.xml.XMLSerializer
are not working
- AlexKaras6 years agoChampion Level 3
Hi,
May I wonder why do you expect net.sf... objects to be imported? Are they in jars that are installed with ReadyAPI? Or have you provided ReadyAPI with the access to the relevant jar(s)?
Have you considered some alternative approach(es)?
For example:
https://stackoverflow.com/questions/29937254/convert-json-to-xml-using-groovy
http://groovy-lang.org/json.html (paragraph about "(
XmlSlurper
for XML being one example)") ?- harry6 years agoContributor
Earlier i was using groovy-1.8.0 jar. I didnot get this issue. It would have been better if you have told what jars to be installed rather posting random question to me.It would have helped me. Here issue is converting json to XML. not parsing json.Even i know based on the error message jar is missing. But dont know what i should install.Ready APi-Ready APi 2.8 coming with Groovy jar-2.4.4 jar. That is having issue. Anyways i figured out the solution. I installed the jars(ezmorph-1.0.1.jar & json-lib-2.4-jdk15.jar). That will solve the problem. If any have any issues like me.
- AlexKaras6 years agoChampion Level 3
Hi,
> It would have been better if you have told what jars to be installed
Have you asked for this?
Plain statement that something does not work means practically nothing because definition of 'work' (and error) is different for different people. And this may cause the one who is agree to spend his/her time to help you to ask additional questions to figure out what exactly does not work and what you are expecting to get.
> i was using groovy-1.8.0 jar
which does not seem to contain net.sf.json.* classes either.
> But dont know what i should install.
Third line of the search result for the https://www.google.com/search?q=jar+for+net.sf.json.JSON request returns a reference to https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.2.3 which points to the json-lib-2.3.3.jar.
Quick look into the <ReadyAPI>\lib\ folder reveals that it contains the json-lib-X.X.X-jdkXX.jar and if you open this file with any zip-archive reader you can ensure that it contains net.sf.json.* classes that you were talking about.
Related Content
- 5 years ago
- 2 years ago
- 11 years ago
- 4 years ago
Recent Discussions
- 18 hours ago
- 17 days ago