Implement Nested Comments Feature for a Comment System

Asked at Bobyard · Coding Questions · Difficulty: Easy

Given an existing comment system where the comments data now includes a `parent` field, implement a feature for nested comments such that child comments are correctly nested under their respective parent comments. Provide a Python function that handles this, taking JSON array formatted data. Each comment is an object with fields: id, content, and parent (null if a root comment). Ensure support for multiple nesting levels.

Loading the problem…