I’m not sure of the full context about why you need to check for camelcase but could you just validate the response against a schema to cover that too?
let schema = {
"type": "object",
"required": [
"success",
"data",
"numberOfElements",
"totalPages",
"totalElements",
"pageNumber",
"pageSize"
],
"properties": {
"success": {
"type": "boolean"
},
"data": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"required": [
"requestUuid",
"messages",
"active",
"objectValid",
"success",
"validated",
"isNew"
],
"properties": {
"requestUuid": {
"type": "string"
},
"messages": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"required": [
"messageType",
"messageCode",
"messageDisplayText",
"priority"
],
"properties": {
"messageType": {
"type": "string"
},
"messageCode": {
"type": "string"
},
"messageDisplayText": {
"type": "string"
},
"priority": {
"type": "integer"
}
}
}
]
}
},
"active": {
"type": "boolean"
},
"objectValid": {
"type": "boolean"
},
"success": {
"type": "boolean"
},
"validated": {
"type": "boolean"
},
"isNew": {
"type": "boolean"
}
}
}
]
}
},
"numberOfElements": {
"type": "integer"
},
"totalPages": {
"type": "integer"
},
"totalElements": {
"type": "integer"
},
"pageNumber": {
"type": "integer"
},
"pageSize": {
"type": "integer"
}
}
}
pm.test("Schema is valid", () => {
pm.response.to.have.jsonSchema(schema)
})