cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Synthetic ResponseBody too large for JSON parsing

droogendijk-phl
Newcomer

In the new HTTP Monitor we're trying to build, we want to monitor an HTTP GET that returns a large json body.

The Execution details show:

"responseSizeInBytes": 62354,
"responseBodySizeLimitExceeded": false,

In the "responseBody" value we can see that the JSON is not fully shown cq. being cut off.

Our current code in the post-execution script:

var responseBody = response.getResponseBody();

if (!responseBody) {
    api.fail("Response body is empty!");
}

try {
    // 2. Try parsing the JSON
    var obj = JSON.parse(responseBody);
    api.info("Successfully parsed JSON.");
} catch (e) {
    api.fail("Failed to parse JSON: " + e.message);
}

 

Error we are getting: Failed to parse JSON: Unterminated array literal"

My guess is that this is because the getResponseBody method is limiting to 50 KB as per the documentation:

response.getResponseBody()—Returns the first 50 KB of the response body as a string. To parse the JSON-formatted response into an object, use, for example:
 
Is there a way to successfully JSON parse a responseBody larger than 50 KB?
2 REPLIES 2

yanezza
Dynatrace Mentor
Dynatrace Mentor

Hi,
I am not aware about an option to increase the limit from your side, you can open a support ticket asking to increase it, it is not an hardcoded limit.

Meanwhile have you tried the http request action in the workflow app?

Yanez Diego Parolin

Hi,

Thank you for the reply.

I've not tested the workflow app yet.

I'll try the support ticket approach first and will keep the workflow app as a potential workaround for now.

Featured Posts