Normalize Mixed to Strings

JavaScript Medium 4 views
Back to Questions

Problem Description

You get a JSON array. Convert each item to a display string: primitives use String(x), null becomes 'null', objects/arrays become JSON string. Print JSON array of these strings.

Input Format

One line JSON array.

Output Format

One line JSON array of strings.

Sample Test Case

Input:
[1,true,null,[2]]
Output:
["1","true","null","[2]"]

Constraints

Array length up to 1e5.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next