From the course: Effective Serialization with Python

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Challenge: Convert log records to JSON

Challenge: Convert log records to JSON - Python Tutorial

From the course: Effective Serialization with Python

Start my 1-month free trial

Challenge: Convert log records to JSON

(upbeat music) - [Lecturer] Here we define the log class. It has the time, which is a datetime, an IP, which is an IP address, a path, which is a str, and a status, which is an HTTPStatus. And then we have a list of such logs. Print the logs to the standard output in JSON format, one object per line.

Contents