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.

James Z
  • 12,209
  • 10
  • 24
  • 44
Sr4
  • 31
  • 3
  • 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. – James Z Feb 22 '22 at 07:15
  • Does this answer your question? [Parse json arrays using HIVE](https://stackoverflow.com/questions/24447428/parse-json-arrays-using-hive) – jeremy-denis Feb 22 '22 at 14:26

0 Answers0