so it has 2 top level keys, inside key 2, the first key is actually a count of how many instances there are of the 2nd level (2)
So this checks out because the 3rd key of the 2nd level has two instances each with 3 keys)
What I want to get is the count of how many instances there are which is 3
I can get the count of how many top level keys there are: jsonTopLevelLength = Object.keys(responseJson).length; = 2
I can get the count of how many 2nd level keys there are: jsonSecondLevelSecondKeyLength = Object.keys(responseJson.TOP LEVEL KEYNAME2).length; = 3
I can even get the count in each of the third level keys there in each instance
Both equal 3 but I just can’t seem to find how do I get a count of for example: Object.keys(responseJson.TOP LEVEL KEYNAME2.2ND LEVEL KEYNAME 3).length
doesnt work as it want to count how many keys there are under 2ND LEVEL KEYNAME 3 and as there are 2 of them it wants me to supply [0] or [1] Thanks a lot
What I am trying to achieve is to verify that both groups of 2ND LEVEL KEYNAME 3 each have those 3 keys inside
The test doesnt know how many groups there are (2) so I need someway to know how many groups of 2ND LEVEL KEYNAME 3 there are, in this case (2) so that I can then run a for loop over both and verify they both have the same 3 keys inside them?
Can this be done? as we have some requests that bring back more than 2 groups so we cant hard code the test
thanks yeah so reading it seems there really is no way to to get the length of 1 when the key value is a single string or integer
So what I came up with is to verify the key value is a string or a number that returns true and if I run it against a key that has an array of values, it fails