You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2022/02/18 17:37:10 UTC

[uima-uimaj-io-jsoncas] 01/01: [No Jira] Add a very short getting started section to the readme

This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch no-issue-improve-readme
in repository https://gitbox.apache.org/repos/asf/uima-uimaj-io-jsoncas.git

commit 60cc7e647755871a229acc7989acc94df24288c6
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Fri Feb 18 18:37:02 2022 +0100

    [No Jira] Add a very short getting started section to the readme
---
 README.adoc | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/README.adoc b/README.adoc
index 1ad4cc3..b1ff61e 100644
--- a/README.adoc
+++ b/README.adoc
@@ -1,6 +1,26 @@
 = JSON serialization of the Apache UIMA CAS
 
-== Introduction
+== Getting started
+
+.Serializing a CAS to JSON
+[source,java]
+----
+import org.apache.uima.json.jsoncas2.JsonCas2Serializer
+
+CAS cas = ...;
+new JsonCas2Serializer().serialize(cas, new File("cas.json"));
+----
+
+.De-serializing a CAS from JSON
+[source,java]
+----
+import org.apache.uima.json.jsoncas2.JsonCas2Deserializer;
+
+CAS cas = ...; // The CAS must already be prepared with the type system used by the CAS JSON file
+new JsonCas2Deserializer().deserialize(new File("cas.json"), cas);
+----
+
+== Specification
 
 This document introduces a new JSON-based serialization format for the UIMA CAS. The new format aims to provide the new go-to solution for encoding UIMA CAS data and to facilitate working with such data cross-platform and cross-programming languages.