ashleynavy
New Member
i want convert json to xml here is code \[code\]public class ConvertJSONtoXML {public static void main(String[] args) throws Exception { InputStream is = ConvertJSONtoXML.class.getResourceAsStream("demo1.txt"); String jsonData = http://stackoverflow.com/questions/12457261/IOUtils.toString(is); XMLSerializer serializer = new XMLSerializer(); JSON json = JSONSerializer.toJSON(jsonData); String xml = serializer.write((JSON) json); System.out.println(xml);\[/code\]here is demo1.txt\[code\]{"name":"naveed" }\[/code\]it reads demo1.txt file and convert into xml but i m trying to pass json as string. \[code\]String jsonString="{\"name\":\"naveed\" }";InputStream is = ConvertJSONtoXML.class.getResourceAsStream(jsonString);\[/code\]but it wont work for string..i thing \[code\]getResourceAsStream(jsonString)\[/code\] doesnt work for string....please suggest any reference