You are given a string s that is intended to be a JSON text. Implement a function isValidJsonStructure(s) -> bool that checks structural validity of the JSON with the following simplified rules:
{ ... }
or
[ ... ]
.
{}
[]
"..."
.
{ } [ ]
) must be ignored for nesting purposes.
\"
closes? no;
\"
contains an escaped quote). In other words,
"
does
not
end a string.
true/false/null
, etc.). Only validate the above structural properties.
s
true
if structurally valid per the rules; otherwise
false
.
1 <= len(s) <= 1e5
"{\"a\":[1,2,3]}"
→
true
"{[}]"
→
false
(bad nesting)
"{\"x\":\"[}\"}"
→
true
(brackets inside a string are ignored)
"{\"a\":\"unterminated}"
→
false
(unclosed string)