qlik sense extract the value from the json

Background

qlik sense doesn’t provide a function to quickly extract the value from the json ,so we have to use many origin functions to get value from the json.
QLIK SENSE本身并没有提供一个JSON解析方法可以直接从JSON中提取值,所以必须用原生方法进行拼凑来提取值.

Requirement

Given that we connect to pgsql for querying the log,
We want to extract the timezone value from the json,
So that we can use the timezone as a field in table.
在这里插入图片描述
我们连接数据库查询日志表,然后从日志表得json中解析出timezone.

the json structure in below:
在这里插入图片描述
Soluction

1.PurgeChar(log,'"') ,remove the special characters,移除特殊符号
在这里插入图片描述

2.SubField(PurgeChar(log,'"'),'timezone:',2) ,substring by timezone and get the part 2 ,根据timezone来分割并获取第二部分
在这里插入图片描述

3.SubField(below_value,',',1) ,substring by below value and then just keep the part 1, 根据以上得值再度分割并且只保留第一部分.

the final expression:
=SubField(SubField(PurgeChar(log,'"'),'timezone:',2),',',1)

verify the expression on table:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值