Azure Load Testing - ERROR o.a.j.e.j.j.JSONPostProcessor: net.minidev.json.parser.ParseException: Malicious payload, having non natural depths.
Hi,
since yesterday evening I've started seeing the following exception
ERROR o.a.j.e.j.j.JSONPostProcessor: net.minidev.json.parser.ParseException: Malicious payload, having non natural depths
when running my Azure Load Tests. It only occurs for big responses, especially the ones including JSONs with multiple nesting levels. Previously everything was working fine and when I run my test locally this exception doesn’t occur. I've found an article - https://github.com/karatelabs/karate/issues/2277 saying that there were some limitations introduced to the library net.minidev.json which is used by this extractor. Also it is described in https://libraries.io/maven/net.minidev:json-smart
Please, kindly assist in resolving the issue.
Today I faced exactly the same error. I use this json library with Spark to parse lots of data. The exception is thrown here. JsonParser keeps track of depth visited so far and because the depth is larger than 400, JsonParser consider it as malicious json. So your json might be too deep.
For me, my json is small and the root cause is JsonParser is not thread safe, and I have multiple threads use same JsonParser which causes the variable
depth
being modified concurrently. The fix for me is easy, just use thread local JsonParser. Hope this helps!