Short snippet illustrating how to use the default JSON serialization for an Apache UIMA CAS object.
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();