import java.io.IOException;
import java.io.StringWriter;
import org.apache.uima.cas.CAS;
import org.apache.uima.json.JsonCasSerializer;
/* After the above imports, and any others... */
CAS cas = assumeWeGetACasFromSomewhere();
JsonCasSerializer jcs = new JsonCasSerializer();
StringWriter sw = new StringWriter();
try {
jcs.serialize(cas, sw);
}
catch (IOException e) {
// Warning: There is a possible exception to handle!
throw e;
}
// Voilà le JSON!
sw.toString();