PostgreSQL: JSON parsing error code: 8001 context: invalid json object
Всем привет.
У меня есть такая строка: [{"desc": "select your age group", "name": "age", "type": "dropdown", "values": ["age 15-30", "age 31-45", "age 46-60"]}]
Я пробую ее распарсить в RedShift (как JSON вытащить из нее ключи, значения).
Пробую так:
WITH all_values AS (
SELECT json_extract_path_text(inputs, 'desc')
FROM source.table
WHERE prompttype = 'input')
SELECT * FROM all_values;
пробую сяк:
WITH all_values AS (
SELECT json_extract_path_text(REPLACE(REPLACE(REPLACE(inputs,'[{','{'), '}]','}'), '"', '\''), 'desc')
FROM source.table
WHERE prompttype = 'input')
SELECT * FROM all_values;
В обеих случаях ошибка:
ERROR: JSON parsing error Detail: ----------------------------------------------- error: JSON parsing error code: 8001 context: invalid json object "[{'name':'cc','desc':'What is your credit card number? I promise to keep it real secure like.','type':'string','regex':'\\\\d+','min_length':1,'max_length':16,'example':'736363627'},{'name':'height','desc':'How tall are you?','type':'i query: 3601508 location: funcs_json.hpp:128 process: query2_124_3601508 [pid=5188] -----------------------------------------------
Никто не подскажет в чем ошибка?