Validate User Record (Multi Errors)

JavaScript Medium 3 views
Back to Questions

Problem Description

One JSON object is given with fields name, age, email. Check: name is non-empty string, age is integer 1..120, email contains @. Print OK if valid else print all errors joined by ;

Input Format

One line JSON object.

Output Format

OK or error list.

Sample Test Case

Input:
{"name":"","age":200,"email":"abc"}
Output:
name;age;email

Constraints

Input is valid JSON.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next