Skip to content

Commit 7b47d25

Browse files
feat: add Raw option for Jq operation
1 parent d9dacf6 commit 7b47d25

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/core/operations/Jq.mjs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ class Jq extends Operation {
3030
name: "Query",
3131
type: "string",
3232
value: ""
33-
}
33+
},
34+
{
35+
name: "Raw",
36+
type: "boolean",
37+
value: false
38+
},
3439
];
3540
}
3641

@@ -40,16 +45,19 @@ class Jq extends Operation {
4045
* @returns {string}
4146
*/
4247
run(input, args) {
43-
const [query] = args;
48+
const [query, raw] = args;
4449
let result;
4550

4651
try {
4752
result = jq.json(input, query);
4853
} catch (err) {
4954
throw new OperationError(`Invalid jq expression: ${err.message}`);
5055
}
51-
52-
return JSON.stringify(result);
56+
if (raw) {
57+
return result;
58+
} else {
59+
return JSON.stringify(result);
60+
}
5361
}
5462

5563
}

0 commit comments

Comments
 (0)