Kusto 的“parse_json”不适用于自定义维度
Kusto's `parse_json` doesn't work on custom dimensions
我希望能够分析存储在发送到应用程序见解的自定义遥测事件的自定义维度中的结构化数据,并获得一些奇怪的行为。似乎 JSON 无法正常解析,但如果我通过 strcat
传递它,它就能很好地解析 json。
customEvents
| where name == "PbConfigFilterComponentSaved"
| take 1
| project
jsonType=gettype(customDimensions.Json),
parsedType=gettype(parse_json(customDimensions.Json)),
strcatType=gettype(strcat('', customDimensions.Json)),
strcatParsedType=gettype(parse_json(strcat('', customDimensions.Json)))
结果:
jsonType: string
parsedType: string
strcatType: string
strcatParsedType: dictionary
是否有更好的方法让 parse_json 处理这种价值?
更新
如果它有任何相关性,这里是 customDimensions.Json
的值:
{"filterComponentKey":"CatalystAgeRange","typeKey":"TemporalConstraint","uiConfig":{"name":"Age","displayMode":"Age"},"config":{"dateSelector":"pat.BirthDTS"},"disabledForScenes":false,"disabledForFilters":false}
- 能否请您演示一个未正确解析的示例记录?
- 推测(在查看数据之前):您是否已确认最后一段 here 不适用于您的情况?
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. […] In such cases, it is not only necessary to invoke parse_json
twice, but also to make sure that in the second call, tostring
will be used. Otherwise, the second call to parse_json
will simply pass-on the input to the output as-is, because its declared type is dynamic
.
我希望能够分析存储在发送到应用程序见解的自定义遥测事件的自定义维度中的结构化数据,并获得一些奇怪的行为。似乎 JSON 无法正常解析,但如果我通过 strcat
传递它,它就能很好地解析 json。
customEvents
| where name == "PbConfigFilterComponentSaved"
| take 1
| project
jsonType=gettype(customDimensions.Json),
parsedType=gettype(parse_json(customDimensions.Json)),
strcatType=gettype(strcat('', customDimensions.Json)),
strcatParsedType=gettype(parse_json(strcat('', customDimensions.Json)))
结果:
jsonType: string
parsedType: string
strcatType: string
strcatParsedType: dictionary
是否有更好的方法让 parse_json 处理这种价值?
更新
如果它有任何相关性,这里是 customDimensions.Json
的值:
{"filterComponentKey":"CatalystAgeRange","typeKey":"TemporalConstraint","uiConfig":{"name":"Age","displayMode":"Age"},"config":{"dateSelector":"pat.BirthDTS"},"disabledForScenes":false,"disabledForFilters":false}
- 能否请您演示一个未正确解析的示例记录?
- 推测(在查看数据之前):您是否已确认最后一段 here 不适用于您的情况?
It is somewhat common to have a JSON string describing a property bag in which one of the "slots" is another JSON string. […] In such cases, it is not only necessary to invoke
parse_json
twice, but also to make sure that in the second call,tostring
will be used. Otherwise, the second call toparse_json
will simply pass-on the input to the output as-is, because its declared type isdynamic
.