i have the xml file, i need to convert into the json. the json output is the partial convert of the xml, not whole xml is converted..

Reason you can find the output of the json, only partial is being converted. remaining portion is omitted.


OUTPUT
======

XML Code:
{"ASF_Service_ResponseVO":{"server_info":{"content":"onboardingv2serv:start_onboarding_session&CalThreadId=85&TopLevelTxnStartTime=13b40fe91c4&Host=L-BLR-00438534&pid=3564","type":"String"},"result":{"id":2,"typesig":"fff96cab366a5def","onboarding_id":{"content":137,"type":"String"},"type":"Onboarding::StartOnboardingSessionResponse","success":{"content":true,"type":"bool"}},"operation":{"content":"start_onboarding_session","type":"String"},"requested_version":{"content":1,"type":"String"},"service":{"content":"OnboardingV2","type":"String"},"actual_version":{"content":1,"type":"String"}}}

INPUT XML FILE
===============
Java Code:
<?xml version="1.0"?>  
<ASF_Service_ResponseVO typesig="155c0afe34b" id="1">  
    <service type="String">OnboardingV2</service>  
    <operation type="String">start_onboarding_session</operation>  
    <requested_version type="String">1.0</requested_version>  
    <actual_version type="String">1.0</actual_version>  
    <server_info type="String">onboardingv2serv:start_onboarding_session&CalThreadId=85&TopLevelTxnStartTime=13b40fe91c4&Host=L-BLR-00438534&pid=3564</server_info>  
    <result typesig="fff96cab366a5def" type="Onboarding::StartOnboardingSessionResponse" id="2">  
        <onboarding_id type="String">137</onboarding_id>  
        <success type="bool">true</success>  
    </result>  
</ASF_Service_ResponseVO>

ConvertXMLtoJSON.java
===============
Java Code:
/* 
 * To change this template, choose Tools | Templates 
 * and open the template in the editor. 
 */  
package javasample1;  
  
//import net.sf.json.JSON;  
//import net.sf.json.JSONObject;   
//import net.sf.json.xml.XMLSerializer;  
import org.json.JSONObject;  
import org.json.JSONException;  
import org.json.XML;  
import java.io.*;  
/** 
 * 
 * @author gopc 
 */  
    public class ConvertXMLtoJSON{  
  
        public static void main(String[] args) throws Exception   
        {  
            try  
            {  
  
                File file = new File ("C:\\Users\\gopc\\Documents\\NetBeansProjects\\JavaSample1\\src\\javasample1\\Sample1.xml");  
                InputStream inputStream = new FileInputStream(file);  
                StringBuilder builder =  new StringBuilder();  
                int ptr = 0;  
                while ((ptr = inputStream.read()) != -1 )  
                {  
                    builder.append((char) ptr);  
                }  
  
                String xml  = builder.toString();  
                JSONObject jsonObj = XML.toJSONObject(xml);   
                System.out.println(jsonObj);  
  
                /* 
                String xmlString  = "<?xml version=\"1.0\"?><ASF_Service_ResponseVO id=\"1\"><service type=\"String\">OnboardingV2</service><operation type=\"String\">start_onboarding_session</operation><requested_version type=\"String\">1.0</requested_version><actual_version type=\"String\">1.0</actual_version><server_info type=\"String\">onboardingv2serv:start_onboarding_session&CalThreadId=85&TopLevelTxnStartTime=13b40fe91c4&Host=L-BLR-00438534&pid=3564</server_info><result type=\"Onboarding::StartOnboardingSessionResponse\" id=\"2\"><onboarding_id type=\"String\">137</onboarding_id><success type=\"bool\">true</success></result></ASF_Service_ResponseVO>"; 
 
                JSONObject jsonObj = XML.toJSONObject(xmlString);  
                System.out.println(jsonObj.toString());  
                */  
            }  
            catch(Exception e)  
            {  
                e.printStackTrace();  
            }  
        }  
}