Fix: [JSON-Query] Prevent parsing string-only JSON (#4425)

pull/4631/head
Nelson Chan 10 months ago committed by GitHub
parent 288cab6dd7
commit 2b8f55194f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -578,8 +578,12 @@ class Monitor extends BeanModel {
let data = res.data;
// convert data to object
if (typeof data === "string") {
if (typeof data === "string" && res.headers["content-type"] !== "application/json") {
try {
data = JSON.parse(data);
} catch (_) {
// Failed to parse as JSON, just process it as a string
}
}
let expression = jsonata(this.jsonPath);

Loading…
Cancel
Save