Get Category path with highest depth

Hi, I have this data, and i would need to find out the “path” with highest “depth” and write it to “category_path” in the root.

{
“category_tree_result”:[
{
“id”: “ACKA_SE_STANDARDNIM_POTISKEM”,
“path”: “ACKA_SE_STANDARDNIM_POTISKEM”,
“depth”: 1
},

{
  "id": "ACKOVE_STOJANY_SE_STANDARDNIM_POTISKEM",
  "path": "PRINT_MENU | Poster_Banner_Printing | ACKOVE_STOJANY_SE_STANDARDNIM_POTISKEM",
  "depth": 3
},

{
  "id": "Poster_Banner_Printing",
  "path": "PRINT_MENU | Poster_Banner_Printing",
  "depth": 2
}

]
}

value setter and JMESpath
&{max_by(category_tree_result, &depth).path}

Hi @vosy,

Could you please confirm whether you already have solved your problem by using the mentioned value setter and JMESpath below?

&{max_by(category_tree_result, &depth).path}

If not yet, could you please share the expected result in Json?

Hi, yea it solved my problem, thank you very much! :slight_smile:

1 Like