@@ -11,43 +11,49 @@ This plugin is automatically installed by the FlowSynx engine when selected in t
1111The JSON Plugin allows FlowSynx users to:
1212
1313- Parse and inspect complex JSON structures.
14- - Extract values using JSONPath.
14+ - Extract values using JSONPath-like expressions .
1515- Flatten nested objects.
1616- Map JSON data to specific output fields using flexible rules.
17+ - Format the output with indentation for readability.
1718
1819It integrates seamlessly into FlowSynx no-code/low-code workflows.
1920
2021---
2122
2223## Supported Operations
2324
24- - ** extract** : Extracts a specific value using a ` jsonPath ` expression.
25+ - ** extract** : Extracts a specific value using a ` Path ` expression.
2526- ** transform** : Flattens a nested JSON structure into flat ` key: value ` pairs.
26- - ** map** : Maps fields to new keys using a dictionary of JSONPath expressions.
27+ - ** map** : Maps fields to new keys using a dictionary of ` Path ` expressions.
28+
29+ Operation names are case-insensitive and passed as part of the ` InputParameter ` .
2730
2831---
2932
3033## Input Parameters
3134
32- Below are the parameters accepted by the plugin :
35+ The plugin accepts the following parameters :
3336
3437- ` Operation ` (string): Required. The type of operation to perform. Supported values are ` extract ` , ` transform ` , and ` map ` .
35- - ` Json ` (string ): Required. The raw JSON string to process.
36- - ` jsonPath ` (string): Required for ` extract ` operation. A JSONPath expression to locate a specific value.
37- - ` Mappings ` (dictionary): Required for ` map ` operation. A dictionary where each key is an output field and each value is a JSONPath expression.
38+ - ` Data ` (object ): Required. The JSON object (or raw JSON string) to process.
39+ - ` Path ` (string): Required for ` extract ` operation. A JSONPath-like expression to locate a specific value.
40+ - ` Mappings ` (dictionary): Required for ` map ` operation. A dictionary where each key is an output field and each value is a ` Path ` expression.
3841- ` Flatten ` (bool): Optional. Used with ` transform ` to specify whether to flatten nested objects (` true ` ) or not (` false ` ).
42+ - ` Indented ` (bool): Optional. Determines whether the output JSON should be pretty-printed with indentation (` true ` ) or compact (` false ` ).
43+
44+ ### Example input
3945
40- Example input:
4146``` json
4247{
4348 "Operation" : " map" ,
44- "Json " : " { ...} " ,
45- "jsonPath " : " $.some.path" ,
49+ "Data " : { ... } ,
50+ "Path " : " $.some.path" ,
4651 "Mappings" : {
4752 "Name" : " $.person.name" ,
4853 "Email" : " $.person.contact.email"
4954 },
50- "Flatten" : true
55+ "Flatten" : true ,
56+ "Indented" : true
5157}
5258```
5359
@@ -57,7 +63,7 @@ Example input:
5763
5864### extract Operation
5965
60- ** Input JSON:**
66+ ** Input JSON Object :**
6167``` json
6268{
6369 "meta" : {
@@ -71,8 +77,8 @@ Example input:
7177``` json
7278{
7379 "Operation" : " extract" ,
74- "Json " : " { ...} " ,
75- "jsonPath " : " $.meta.version"
80+ "Data " : { ... } ,
81+ "Path " : " $.meta.version"
7682}
7783```
7884
@@ -83,9 +89,38 @@ Example input:
8389
8490---
8591
92+ ** Input JSON Array:**
93+ ``` json
94+ [
95+ { "id" : 1 },
96+ { "id" : 2 },
97+ { "id" : 3 }
98+ ]
99+ ```
100+
101+ ** Input Parameters:**
102+ ``` json
103+ {
104+ "Operation" : " extract" ,
105+ "Data" : " [...]" ,
106+ "Path" : " $[*].id"
107+ }
108+ ```
109+
110+ ** Output:**
111+ ``` json
112+ [
113+ 1 ,
114+ 2 ,
115+ 3
116+ ]
117+ ```
118+
119+ ---
120+
86121### transform Operation
87122
88- ** Input JSON :**
123+ ** Input Data :**
89124``` json
90125{
91126 "user" : {
@@ -101,8 +136,9 @@ Example input:
101136``` json
102137{
103138 "Operation" : " transform" ,
104- "Json" : " {...}" ,
105- "Flatten" : true
139+ "Data" : { ... },
140+ "Flatten" : true ,
141+ "Indented" : true
106142}
107143```
108144
@@ -118,7 +154,7 @@ Example input:
118154
119155### map Operation
120156
121- ** Input JSON :**
157+ ** Input Data :**
122158``` json
123159{
124160 "person" : {
@@ -134,11 +170,12 @@ Example input:
134170``` json
135171{
136172 "Operation" : " map" ,
137- "Json " : " { ...} " ,
173+ "Data " : { ... } ,
138174 "Mappings" : {
139175 "Name" : " $.person.name" ,
140176 "Email" : " $.person.contact.email"
141- }
177+ },
178+ "Indented" : false
142179}
143180```
144181
@@ -156,17 +193,17 @@ Example input:
156193
1571941 . Add the JSON plugin to your FlowSynx workflow.
1581952 . Set ` Operation ` to one of: ` extract ` , ` transform ` , or ` map ` .
159- 3 . Provide the JSON input string .
160- 4 . Configure ` jsonPath ` , ` Mappings ` , or ` Flatten ` depending on the operation.
161- 5 . Use the output downstream in your workflow.
196+ 3 . Provide the JSON input object in ` Data ` .
197+ 4 . Configure ` Path ` , ` Mappings ` , ` Flatten ` , and ` Indented ` depending on the operation.
198+ 5 . Use the plugin output downstream in your workflow.
162199
163200---
164201
165202## Debugging Tips
166203
167- - If the result is null, ensure ` jsonPath ` is valid and points to an existing element.
168- - If nothing is mapped, check for typos in the JSONPath expressions inside ` Mappings ` .
169- - If the result isn't flattened, double-check that ` Flatten ` is set to ` true ` .
204+ - If the result is null, ensure ` Path ` is valid and points to an existing element.
205+ - If nothing is mapped, check for typos in the ` Path ` expressions inside ` Mappings ` .
206+ - To get human-readable output, set ` Indented ` to ` true ` .
170207
171208---
172209
0 commit comments