how to read JSON in Audience Stream

Bronze Contributor
Bronze Contributor

I have the same question as mentioned in below post, and creating new one since it's pretty old and recommendation is not clear or may be I couldn't get it.

https://community.tealiumiq.com/t5/Tealium-EventStream/lifetime-spend-for-each-category/m-p/35530#M1...

what I have done:

I tried persisting the product id and each categories in a cookie which stores the product id and category mapping in a JSON object. On the order confirmation page, I have product id details and I can look up the product category information based on the persisted values. However, I'm wondering what type of data type in AS should I use in order to read this value.
Basically, I will populate subtotal of each category (lets say 2 products were purchased of the same category, I will sum them up) and we will not have the details about how many categories user may purchase.

{
'category1': 5000.
'category2': 2000
...
}

OR, is there a easy way to solve this problem?

Public