New course! Every coder should learn Generative AI!
Try a free lesson2 Answers
+ 1
I think the standard json module can do this with json.dumps() but I haven't tried it.
Check:
https://stackoverflow.com/questions/43469412/convert-html-source-code-to-json-object/43469641#43469641