Klasse JSONParser

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

public class JSONParser extends Object
The JSONParser is an utility class to parse JSON structures. The parser provides methods to transfer a Imixs JSON structure into a Imixs ItemCollection as well as helper methods to extract single values from a JSON structure.

The method parseWorkitem translates a JSON structure containing a Imixs Document into a ItemCollection.

Autor:
rsoika
  • Konstruktordetails

    • JSONParser

      public JSONParser()
  • Methodendetails

    • getKey

      public static String getKey(String key, String json)
      This method extracts a single key from a JSON structure. It does not matter where the key is defined within the JSON structure. The method simply returns the first match.

      It is also possible to get a JSON object or an JSON array embedded in the given JSON structure. This object can be parsed again with this method.

      Parameter:
      key -
      json -
      Gibt zurück:
      - the json value or the json object for the corresponding json key
    • parseWorkitem

      @Deprecated public static final ItemCollection parseWorkitem(InputStream requestBodyStream, String _encoding) throws ParseException, UnsupportedEncodingException
      Veraltet.
      This method parses an Imixs JSON input stream and returns a Imixs ItemCollection. Example: { "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"}} ] }
      Parameter:
      requestBodyStream -
      encoding - - default encoding use to parse the stream
      Gibt zurück:
      a workitem
      Löst aus:
      ParseException
      UnsupportedEncodingException