Extract values from JSON in correct sequence

I have a Table in which are JSON´s and they are very nested, some more some less.
They look like this:

[{
“teststeps” : [ {
“name” : “b”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “‘xyz’”,
“dType” : “TestStep”
} ],
“name” : “a”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“name” : “d”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “e”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“teststeps” : [ {
“name” : “g”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “f”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
} ],
“name” : “c”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“name” : “i”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “j”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “k”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“teststeps” : [ {
“name” : “m”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “n”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“teststeps” : [ {
“name” : “p”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “o”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
} ],
“name” : “l”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“name” : “r”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “q”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“teststeps” : [ {
“name” : “u”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “t”,
“description” : “null”,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
} ],
“name” : “s”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
} ],
“name” : “h”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“teststeps” : [ {
“name” : “x”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “w”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“name” : “z”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “z”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “aa”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “ab”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “v”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“teststeps” : [ {
“name” : “ad”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “ae”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “af”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
} ],
“name” : “ac”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStepFolder”
}, {
“name” : “ag”,
“description” : null,
“verdict” : “PASSED”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}, {
“name” : “ah”,
“description” : null,
“verdict” : “NONE”,
“expectedResult” : “xyz”,
“dType” : “TestStep”
}]

As you see there are TestSteps and TestFolders. The TestSteps are always above the TestFolder to which they belong.
The correct sequence of this JSON look like this:

what i want is that a new column is created in which the name and the name are verdicts are all togheter in the correct sequence with a number.

So the result should be in this example:

1/a/NONE, 2/b/NONE, 3/c/PASSED, 4/d/NONE, 5/e/NONE, 6/f/PASSED, 7/g/NONE, 8/h/PASSED, 9/i/NONE, 10/j/NONE, 11/k/NONE, 12/l/PASSED, 13/m/NONE, 14/n/PASSED, 15/o/PASSED, 16/p/PASSED, 17/q/PASSED, 18/r/PASSED, 19/s/NONE, 20/t/NONE, 21/u/NONE, 22/v/PASSED, 23/w/NONE, 24/x/NONE, 25/y/PASSED, 26/z/PASSED, 27/aa/PASSED, 28/ab/PASSED, 29/ac/PASSED, 30/ad/PASSED, 31/ae/PASSED, 32/af/PASSED, 33/ag/PASSED, 34/ah/NONE

How can this be done? Maybe the easiest way is JAVA Snippet? Because parsing this JSONs which are so nested seemed very hard for me

Hi @simonmng

Query all names and verdicts with $..name and $..verdict. Make sure to enable the List output.

Use an Ungroup node to get the type of overview you’re after.

2 Likes