cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

is it possible to search and parse an specific Json List position ?

dannemca
DynaMight Guru
DynaMight Guru

Let me try to explain what I need.

I am extracting data using Bizevents, and one of the fields I need is a list inside a Json in response Body.

I know that I can parse the json to extract the specific position of that list, like "List.0.0.Key" to get the first Key value at the first List position, but the List I have is not constant. I may have data in the position 3 but none in the firsts positions, and at each position, I may have a serie of different number of values.

Example:

 

"List":[
[{"keyA0.0":"valueA0.0","keyB0.0":"valueB0.0"},{"keyA0.1":"valueA0.1","keyB0.1":"valueB0.1"}],
[{"keyA1.0":"valueA1.0","keyB1.0":"valueB1.0"},{"keyA1.1":"valueA1.1","keyB1.1":"valueB1.1"},{"keyA1.2":"valueA1.2","keyB1.2":"valueB1.2"},{"keyA1.3":"valueA1.3","keyB1.3":"valueB1.3"}],
[{"keyA2.0":"valueA2.0","keyB2.0":"valueB2.0"},{"keyA2.1":"valueA2.1","keyB2.1":"valueB2.1"}],
[{"keyA3.0":"valueA3.0","keyB3.0":"valueB3.0"},{"keyA3.1":"valueA3.1","keyB3.1":"valueB3.1"},{"keyA3.2":"valueA3.2","keyB3.2":"valueB3.2"}],
[],
[{"keyA5.0":"valueA5.0","keyB5.0":"valueB5.0"},{"keyA5.1":"valueA5.1","keyB5.1":"valueB5.1"}],
[],
[{"keyA7.0":"valueA7.0","keyB7.0":"valueB7.0"},{"keyA7.1":"valueA7.1","keyB7.1":"valueB7.1"}],
[],
[],
[{"keyA10.0":"valueA10.0","keyB10.0":"valueB10.0"}],
[]
]

 

 

Since the size of the list is not known, I can not simply create a series of extractions, and I will end up crazy with too many fields.

What I need to know is, Is it possible to search for a specific string in this list, and it return me the position of it in the list? Like, search for "valueB5.1" and it return me it is in "List.5.1.keyB5.1"?

Thanks

Site Reliability Engineer @ Kyndryl
1 REPLY 1

radek_jasinski
DynaMight Guru
DynaMight Guru

Hi @dannemca 

Analyzing your need, I don't know if this can be done with DQL, because due to the list structure, which is irregular and contains nested lists and dictionaries, it may be difficult to directly search this data using DQL. DQL is more focused on metrics and performance than processing complex data structures. You may need to use an external script, e.g., in Python, and send this data through an API.

You can still ask support. Maybe they will help.

Radek

Have a nice day!

Featured Posts