【发布时间】:2019-08-31 05:13:47
【问题描述】:
最终目标或问题的根源是在 json_extract_path_text Redshift 中有一个兼容的字段。
这就是现在的样子:
{'error': "Feed load failed: Parameter 'url' must be a string, not object", 'errorCode': 3, 'event_origin': 'app', 'screen_id': '6118964227874465', 'screen_class': 'Promotion'}
为了从 Redshift 中的字符串中提取我需要的字段,我将单引号替换为双引号。 特定记录给出错误,因为在错误值内部,那里有一个单引号。这样,如果这些字符串也被替换,字符串将是无效的 json。
所以我需要的是:
{"error": "Feed load failed: Parameter 'url' must be a string, not object", "errorCode": 3, "event_origin": "app", "screen_id": "6118964227874465", "screen_class": "Promotion"}
【问题讨论】:
-
你试过
json.dumps(d)吗?
标签: python