25 Sep 2025 12:13 AM
I have a variable within my application that contains a Key and Value variable. How can I extract the variables to obtain this data from the user sessions? For example: the variable is called "offer." Inside it is a JSON file containing different variables at various levels, payments: 10. I want to obtain payments.
This is done in the session properties to obtain business data.
25 Sep 2025 12:40 AM - edited 25 Sep 2025 12:44 AM
Hi if you're using RUM JavaScript version 1.295 or later, Dynatrace supports direct JSON parsing from session storage or JavaScript variables.
If your variable is:
{
"offer": {
"payments": 10,
"details": {
"currency": "USD"
}
}
And it's stored in sessionStorage.offer, you can extract payments like this:
If your variable is already a JSON string, use sessionStorage.offer.$payments. If it's a nested object, you can go deeper like sessionStorage.offer.$details.currency.
You can also check the official documentation for reference: https://docs.dynatrace.com/docs/shortlink/user-session-properties