This method takes a delimited string, and returns its tokens in a List of Map<String,String> objects. You can use a JSON transform to map those tokens back into your application data as required.
- Class: com.pega.launchpad.parser.Parser
- Method: fromDelimitedText
- Function handler: com.pega.launchpad.parser.Parser::fromDelimitedText
- Input parameters:
- text (Text): the delimited string to parse
- delim (Text): optional - the delimiter that was used (default is ",")
- Output parameters:
- Type: [choose one of your application's case types, doesn't matter which one]
- Cardinality: Multiple
- Note: JSON Transform rule will be required
- Create JSON Transform rule with:
- Name: the same name as your function (not required, just easier for author)
- Purpose: Deserialize (JSON to Pega Object)
- Library: Same as the case type chosen for the Function rule's output parameter Type
- Top level structure: Multiple record
- Add source JSON data:
- System name: any identifier you want
- JSON sample:
[{"token":"foo"},{"token":"bar"}]
- Map your data:
- Source field: token(STRING)
- Target field: Your application field
This method takes the content of a CSV file (headers required), and returns a list of Map objects, where each object has member fields where the field name is the column name from your CSV header, and the value is the value for that column for that record. You must use a JSON Transform to map this list of objects back into your application object structure.
- Class: com.pega.launchpad.parser.Parser
- Method: fromCsv
- Function handler: com.pega.launchpad.parser.Parser::fromCsv
- Input parameters:
- csv (Text): csv file content to parse
- Output parameters:
- Type: [choose one of your application's case types, doesn't matter which one]
- Cardinality: Multiple
- Note: JSON Transform rule will be required
- Create JSON Transform rule with:
- Name: the same name as your function (not required, just easier for author)
- Purpose: Deserialize (JSON to Pega Object)
- Library: Same as the case type chosen for the Function rule's output parameter Type
- Top level structure: Multiple record
- Add source JSON data:
- System name: any identifier you want
- JSON sample: a json array with one element: a json object representing one record in your csv, with name:value pairs corresponding to the column names and record values. Example:
[{"name":"tim","city":"Waltham","state":"MA"}]
- Map your data. Using the above name/city/state structure as an example:
- Source field: name(STRING)
- Target field: .CustomerName
- Source field: city(STRING)
- Target field: .CustomerCity
- Source field: state(STRING)
- Target field: .CustomerState
This method takes a json string, containing a single top-level object, and returns a TreeMap. The returned map can be processed by a JSON Transform to map values back into your application data structure.
- Class: com.pega.launchpad.parser.Parser
- Method: fromJsonObject
- Function handler: com.pega.launchpad.parser.Parser::fromJsonObject
- Input parameters:
- json (Text): The json string to evaluate
- Output parameters:
- Type: [choose the application case type you want to map data into]
- Cardinality: Single
- Note: JSON Transform rule will be required
- Create JSON Transform rule with:
- Name: the same name as your function (not required, just easier for author)
- Purpose: Deserialize (JSON to Pega Object)
- Library: Same as the case type chosen for the Function rule's output parameter Type
- Top level structure: Single record
- Add source JSON data:
- System name: any identifier you want
- JSON sample:
(example json structure from your use case)
- Map your data from the JSON structure into your application object structure
This method takes a json string, containing a top-level array of objects, and returns a List of TreeMap objects. The returned maps can be processed by a JSON Transform to map values back into your application data structure.
- Class: com.pega.launchpad.parser.Parser
- Method: fromJsonArray
- Function handler: com.pega.launchpad.parser.Parser::fromJsonArray
- Input parameters:
- json (Text): The json string to evaluate
- Output parameters:
- Type: [choose the application case type you want to map data into]
- Cardinality: Multiple
- Note: JSON Transform rule will be required
- Create JSON Transform rule with:
- Name: the same name as your function (not required, just easier for author)
- Purpose: Deserialize (JSON to Pega Object)
- Library: Same as the case type chosen for the Function rule's output parameter Type
- Top level structure: Multiple records
- Add source JSON data:
- System name: any identifier you want
- JSON sample:
(example json structure from your use case)
- Map your data from the JSON structure into a multi-object field in your application object structure