← Questions

Collapsible JSON viewer in React

0
NotionCodingLast asked Jul 2025

In an hour of React, pretty-print a JSON value (objects, arrays, strings, numbers) with indentation, and give every nested object and array a toggle that collapses it to a placeholder and expands it again. Build it as a recursive component, decide where the collapsed state lives, and handle empty objects and arrays.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding