Problems

JSON Parse or Default

EasyError Handling

Each input line is supposed to be JSON. Print the parsed value re-stringified; if parsing throws, print INVALID for that line.

Input: one or more lines. Output: one result per line.

Your program reads from stdin and prints to stdout.

Example 1

Input: {"a":1} not json [1,2]

Output: {"a":1} INVALID [1,2]

Hints

JavaScripttry-catchJSON
JSON Parse or Default | CodeForge AI