It looks like you can easily assert the values 1009 and SOME RANDOM MESSAGE using JSONPath expressions (in the JSON Path Assertion components), but you are not sure about 123456789 : this is not a node value, but the name is bode, and the JSONPath implementation used by these components does not seem to be has expressions to get the name node.
Suppose you can easily use 123456789 for approval instead of associating a JSON Path Extractor (from the same component collection) with the jmeter Response_Assertion standard.
Add 2 JSON Path Assertions as children of the sampler that returns the json response you want to handle:


The expressions will be $.result.errors..code and $.result.errors..error respectively.
Add the JSON Path Extractor as a child of the same sampler to retrieve the full error record:

Expression: $.result.errors. .
This will extract {"123456789":{"error":"SOME RANDOM MESSAGE","code":1009}} and save it to a pointed variable ( ${errorKey} ).
Add the response response as a child to the same sampler, after adding the JSON Path Extractor:

This will indicate the key name ( 123456789 ) in the value of the variable ${errorKey} .
So, the final design may look like
... YOUR Sampler JSON Path Extractor JSON Path Assertion JSON Path Assertion Response Assertion ...
Aliaksandr Belik
source share