Access escaped JSON in mySql Query -
i'm running mysql query this:
select * reserror errordescription '%ensure name dob , gender exist in ssr docs%'
this returns results like:
+-----------+--------------------------------------------+ | id | errordescription | +-----------+--------------------------------------------+ | 1 | {\r\n \"details\": \"invalid - ensure.... | +-----------+--------------------------------------------+
the full text of errordescription
field escaped json object this:
{\r\n \"details\": \"invalid - ensure name dob , gender exist in ssr docs \",\r\n \"session\": {\r\n \"flighttype\": \"worldspan\",\r\n \"pt\": \"hf\",\r\n \"fl\": \"pdx\",\r\n \"tl\": \"phx\",\r\n \"xmlconnectionid\": \"9\",\r\n \"flightdetails\": {\r\n \"issuingcarriercode\": \"us\",\r\n \"restrictedticket\": \"1\",\r\n },\r\n \"reservationid\": 21614475,\r\n \"pnr\": \"lq8o7m\"\r\n }\r\n}
there more values have left out, listed ones care about
the un-escaped json object this
{ "details": "invalid - ensure name dob , gender exist in ssr docs us", "session": { "flighttype": "worldspan", "pt": "hf", "fl": "pdx", "tl": "phx", "xmlconnid": "9", "flightdetails": { "issuingcarriercode": "us", "restrictedticket": "1", }, "resid": 2161, "pnr": "lq8rrm" } }
how can access values in text of errordescription field end results below?
+----+-----------+----+-----+-----+-----------+--------------------+------------------+--------+ | id | flighttype| pt | fl | tl | xmlconnid | issuingcarriercode | restrictedticket | pnr | +----+-----------+----+-----+-----+-----------+--------------------+------------------+--------+ | 1 | worldspan | hf | pdx | phx | 9 | | 1 | lq8rrm | +----+-----------+----+-----+-----+-----------+--------------------+------------------+--------+
i love normalize stored data, unfortunately, not option. department not have write access table , department owns wants stay way is. not query ever need run again performance not primary concern.
this mysql version working with:
Comments
Post a Comment