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:
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).
Amazon Redshift supports the parsing of JSON data into SUPER and up to 5x faster insertion of JSON/SUPER data in comparison to inserting similar data into classic scalar columns. PartiQL is an extension of SQL that is adopted across multiple AWS services.
The "SyntaxError: JSON. parse: unexpected character" error occurs when passing a value that is not a valid JSON string to the JSON. parse method, e.g. a native JavaScript object. To solve the error, make sure to only pass valid JSON strings to the JSON.
You can easily load data from JSON to Redshift via Amazon S3 or directly using third party Data Integration tools. Redshift also provides you with in-built SQL commands to carry out the data loading process. You can also use other AWS services like AWS Glue to load data from JSON to Redshift.
The JSON_EXTRACT_PATH_TEXT function returns the value for the key:value pair referenced by a series of path elements in a JSON string. The JSON path can be nested up to five levels deep. Path elements are case-sensitive.
Ok, per this Redshift forum post this is a know bug, but there is no ETA for a fix. The forum recommends this workaround:
Replace:
json_extract_path_text(event_properties,'someValue')
with
json_extract_path_text(regexp_replace(event_properties,'\\\\.',''),'someValue')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With