I want to extract an element from a json in a column.
However, the key of the element I am interested contains %
(the exact name is: Use%
).
Following this, I tried to use double quotes, however, I still have the same problem:
JSON_VALUE(results, '$."Use%"') as value
JSON text is not properly formatted. Unexpected character ''' is found at position 1.
JSON_VALUE(results, '$.Use%') as value
JSON path is not properly formatted. Unexpected character '%' is found at position 5.
How can I extract the value from my json string ?
The JSON is the following:
{'Filesystem': 'hdfs://nameservice1', 'Size': '67945349394432', 'Used': '22662944968704', 'Available': '41812184838144', 'Use%': '33%'}
REPLACE
those single quotes ('
) with double quotes ("
). Once you do that, your first attempt works fine.