Problems

Flatten Children

MediumReact Components

React flattens nested children arrays and drops null/false. Input: a JSON array that may contain strings, numbers, nulls, booleans, and nested arrays. Print the flattened render list as a JSON array of strings (numbers stringified, null/false/true removed).

Input: one JSON array. Output: flat JSON array of strings.

Your program reads from stdin and prints to stdout.

Example 1

Input: ["a",["b",null,["c"]],false,1]

Output: ["a","b","c","1"]

Hints

ReactComponentsChildren
Flatten Children | CodeForge AI