How would you implement a function to validate if a given string represents a valid JSON payload?
Implement is_valid_json(s) without using a JSON parsing library. Return True only when the complete input is one valid JSON value, followed only by whitespace. Support objects, arrays, strings, numbers, true, false, and null.
Input is a string. Output is a boolean. Reject malformed escape sequences, invalid numbers, missing delimiters, trailing characters, and unescaped control characters. Duplicate object keys are allowed.
def is_valid_json(s):