Solved

When running JSON Fragmenter, can I capture the last JSON Index from each row into its own attribute value for every row after the fragment is done?

  • 12 December 2021
  • 2 replies
  • 19 views

I'm running JSON Fragmenter to break out an array, and, in the process, it indexes each row of that ID. Is there a way to retroactively put the last JSON Index value of each ID's array into every row associated with that ID? I'm trying to calculate a percentage of where each row is compared to its total. (JSON index [8] of ID XXXX is in the first 2.34% of ID XXXX's total JSON Index.)

 

Thanks, in advance!

icon

Best answer by todd_davis 12 December 2021, 02:12

View original

2 replies

Userlevel 1
Badge +12

So the way I am interpreting what you have written is that you have split the json array into separate features and they hold the json index value.

 

You just need to do is put the records through a StatisticsCalculator, with a group by of the "ID" and then a stat of the max. But you may need to "add 1" to each json_index because it will start at 0, rather than 1.

 

An example is attached, but I have not added the 1 to the json index in it.

 

Cheers,

Todd

Thanks, Todd!

 

I also ran across this post, where Takashi queried the JSON Count prior to splitting the array.

 

https://community.safe.com/s/question/0D54Q000080hL8C/count-elements-in-json-array

 

Thanks, again.

 

Ryan

Reply