JSON payload not acceptable generated in automation execution

Hello Robert,

I’ve written a java code to generate JSON payload and working as expected in assembly editor, no issue at all. The output of assembly editor:

When I execute automation I get an error saying:
{
“code”: 400,
“message”: “Invalid json message received”
}

I’ve checked the log also and the response received:

Which I have checked by executing in POSTMAN and same error appear. Could you guide me how should I handle this type of situation?
Assembly UUID: 8547b053ba41411e859e310b33366a74 and 15e1f5e0c281403486fb2a5da0ffba09

Both the output are valid JSON but the last one is not working for API execution.

Try using the Java trim() method to strip leading and trailing whitespace from the values, like this:

appRPC.escapeJsonString(appRPC.getActionFieldValue(doc_action, “name_title”).trim())