0

I have the below column product_details where I want to extract the code where the colour is green.

Column - product_details

"[
{\"colour\":\"red\",\"code\":1,\"id\":111\"},{\"colour\":\"blue\",\"code\":4,\"id\":222\"},{\"colour\":\"green\",\"code\":6,\"id\":333\"}
]"

o/p: 6

I tried regex_replace and regex_extract to get the value. But not successful.

2
  • Trying to parse json (or xml, html etc) with regex is usually a bad idea, since regex doesn't work well with structures like that. Commented Feb 22, 2022 at 7:15
  • Does this answer your question? Parse json arrays using HIVE Commented Feb 22, 2022 at 14:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.