I've got a log file, where each line is a JSON. Due to some Nginx security reasons, the logs are being saved in a hexadecimal format (e.g. the char " will be converted to \x22). Here is an example of a JSON line:
{ "body_bytes_sent": "474", "params": {\x22device_id\x22: \x221234567890\x22} }
My goal:
- Read the file line by line.
-
Convert each line to a readable format
{ "body_bytes_sent": "474", "params" : {"device_id": "1234567890"} }
Convert this string into a JSON object so I could manipulate it.
Any help will be appreciated.