Initial TCA commit into DCAEGEN2
[dcaegen2/analytics/tca.git] / dcae-analytics-cdap-plugins / docs / JsonPathFilter-transform.md
1 # JSON Path Filter
2
3 ## Description
4
5 Filters incoming JSON based on given filter mappings.
6
7 The mappings in the plugin will be:
8
9     +================================================+
10     |   JSON Path Expression    |   Expected Values  |
11     |---------------------------|--------------------|
12     |$.employee.name.first      |    rajiv;manjesh   |
13     |$.employee.name.last       |   singla;gowda     |
14     |$.employee.email           |   johndoe@xyz.com  |
15     +================================================+
16     
17 The above filter mappings will inside json path $.employee.name.first and check if value matches rajiv or manjesh. 
18 Only if path does exist and matches any of the expected values rajiv or manjesh then first filter mapping will be true.
19
20 If multiple mappings are provided all mapping must be true for result to be matched.
21
22 If incoming json is null or empty then output result will be null as no matching is possible.
23
24 ### Expression
25
26 The "root member object" for parsing any JSON is referred to as ```$```, regardless of
27 whether it's an array or an object. It also uses either dot notation or bracket notation for
28 defining the levels of parsing. For example: ```$.employee.name``` or ```$[employee][name]```.
29
30 #### Supported Operators
31
32 These operators are supported:
33
34     +========================================================================+
35     | Operator          | Description                                        |
36     |-------------------|----------------------------------------------------|
37     | $                 | The root element of the query                      |
38     | *                 | Wildcard                                           |
39     | ..                | Deep scan                                          |
40     | .<name>           | Dot notation representing child                    |
41     | [?(<expression>)] | Filter expression, should be boolean result always |
42     +========================================================================+