Class ImixsJSONParser

java.lang.Object
org.imixs.workflow.util.ImixsJSONParser

public class ImixsJSONParser extends Object
The ImixsJSONParser is an utility class to parse JSON structures of Imixs Documents. The parser supports single document structures as also collections of documents (data element).

The method 'parse()' returns in any case a collection of ItemCollection.

Author:
rsoika
  • Field Details

  • Constructor Details

    • ImixsJSONParser

      public ImixsJSONParser()
  • Method Details

    • parse

      public static final List<ItemCollection> parse(InputStream jsonDataStream) throws ParseException, UnsupportedEncodingException
      This method parses an Imixs JSON input stream and returns a List of Imixs ItemCollection instances.

      The method supports both - a single document (item element) or a collection of documents (data element). In both cases the method returns a collection of ItemCollections Example-1: { "item":[ {"name":"$isauthor","value":{"@type":"xs:boolean","$":"true"}}, {"name":"$readaccess","value":{"@type":"xs:string","$":"Anna"}}, {"name":"txtmessage","value":{"@type":"xs:string","$":"worklist"}}, {"name":"txtlog","value":[ {"@type":"xs:string","$":"A"}, {"@type":"xs:string","$":"B"}, {"@type":"xs:string","$":"C"}] }, {"name":"$activityid","value":{"@type":"xs:int","$":"0"}} ] } Example-2: { "data": [ { "item":[ {"name":"$isauthor","value":{"@type":"xs:boolean","$":"true"}}, {"name":"$readaccess","value":{"@type":"xs:string","$":"Anna"}} ] }, { "item":[ {"name":"$isauthor","value":{"@type":"xs:boolean","$":"true"}}, {"name":"$readaccess","value":{"@type":"xs:string","$":"Anna"}} ] } ] }

      Parameters:
      requestBodyStream -
      encoding - - default encoding use to parse the stream
      Returns:
      a workitem
      Throws:
      ParseException
      UnsupportedEncodingException