Skip to main content

I have thousands of JSON files, containing metadata. Although these all metadata are not relevant, hence tried to filter out only relevant data using test conditions. The problem is that the JSON file structure is a bit inconsistent.

For example-

I want to extract "Roll" data from JSONs and when exposing the attribute through the "Attribute Exploder" transformer, it shows data varies widely from one JSON to another (see the below example)

metadata{20}.metadata.roll

metadata{43}.metadata.roll

metadata{45}.metadata.roll

metadata{52}.metadata.roll

metadata{106}.metadata.roll

metadata{844}.metadata.roll etc. etc.

 

Now I am trying to find the "Roll" data using test condition within the "Tester" transformer (see below example)

WhatsApp Image 2022-11-08 at 17.13.30.jpeg I know, this is challenging to find the desired value if the JSON structure changes from one to another. I am trying to find out an easy way to use the test condition. Not sure which expression can show a range of the values within curly braces {}.

I am trying to write the expression something like the following way

Test condition

if metadata{1-1000}.metadata.roll=ATTRIBUTE_HAS_A_VALUE

Else Missing

 

But this is not working. It would be really helpful if anyone from this forum could help me understand the right expression or provide other ideas to solve the issue. Thanks in advance.

Perhaps you could explode the list into individual features and then test each feature for itself?


Reply