为什么Amazon Redshift无法解析此有效JSON字符串?

时间:2022-01-01 23:04:27

I'm using Amazon Redshift's JSON parsing abilities. Most of the time it works, but it fails in this case. I'm getting the following error:

我正在使用Amazon Redshift的JSON解析功能。它大部分时间都有效,但在这种情况下失败了。我收到以下错误:

error:  JSON parsing error
  code:      8001
  context:   invalid json object {"collection_id": 12, "activity_name": "Hour of Zen: The \"Dead Sea\" Float"}

I was under the impression that the backslash was the proper escape for the double quote (and this was automatically generated by Python's JSON package).

我的印象是反斜杠是双引号的正确转义(这是由Python的JSON包自动生成的)。

1 个解决方案

#1


5  

Ok, per this Redshift forum post this is a know bug, but there is no ETA for a fix. The forum recommends this workaround:

好的,根据这篇Redshift论坛帖子,这是一个已知的错误,但是没有针对修复的ETA。论坛推荐此解决方法:

Replace:

更换:

json_extract_path_text(event_properties,'someValue')

with

json_extract_path_text(regexp_replace(event_properties,'\\\\.',''),'someValue')

#1


5  

Ok, per this Redshift forum post this is a know bug, but there is no ETA for a fix. The forum recommends this workaround:

好的,根据这篇Redshift论坛帖子,这是一个已知的错误,但是没有针对修复的ETA。论坛推荐此解决方法:

Replace:

更换:

json_extract_path_text(event_properties,'someValue')

with

json_extract_path_text(regexp_replace(event_properties,'\\\\.',''),'someValue')