02 Nov 2023 11:49 AM
Hello,
I have to extract business insights from user sessions as user session properties. Data is stored on Storage session in a key named currentStore :
Inspiring by the @Julius_Loman 's RFE https://community.dynatrace.com/t5/Product-ideas/Browser-Local-Storage-or-Session-Storage-values-for... , I use the type javascript variable sessionStorage.currentStore
I am able to catch the value but in my case it's a json content so I have to execute a cleaning rule to keep only the id or name values :
From a performance perspective, is it possible to parse the JSON directly to extract only the id and name values ?
I tried to configure like below but it didn't work :
Thank you.
Regards Aurélien.
Solved! Go to Solution.
02 Nov 2023 12:08 PM
Very good question! I'd love to find out too:)
02 Nov 2023 12:13 PM
@AurelienGravier what about cleanup rule? You need to use regex, so ... it's not exactly parsing a JSON, but the following should work for you:
"id":\s*+"(\d*+)"
"name":\s*+"([^"]*+)"
02 Nov 2023 12:29 PM - edited 02 Nov 2023 12:43 PM
@Julius_Loman it works but It would be a more sustainable because :
- the string length capture is limited to 1000 first char :
- if I select 1000 it consumes like 10 properties :
id":"([^"]*+)
and
name":"([^"]*+)
02 Nov 2023 12:49 PM
Well, in such cases, I really recommend sending the properties using RUM JS API instead and you won't need to capture a lengthy string which will be cleaned down to few characters.