import org.json.XML; import java.io.*; import org.json.JSONObject; import org.json.XML; import com.adeptia.indigo.services.ServiceException; try { StringBuilder builder = new StringBuilder(); int ptr = 0; // inputStream of previous defined activity in the Adeptia process flow while ((ptr = inputStream.read()) != -1 ) { builder.append((char) ptr); } String xml = builder.toString(); JSONObject jsonObj = XML.toJSONObject(xml,false); context.put("JSONObject", jsonObj.toString()); service.write( jsonObj.toString().getBytes(),"default"); } catch(Exception e) { throw new ServiceException(e); }