You can write your own subclass of JsonReader to accomplish this, but the JsonTextReader class (which is most commonly used as far as I know) does not support this. From the ParseValue method, for example:
case '"': case '\'': ParseString(currentChar, ReadType.Read); return true;
I have a strict JSON tokenizer on Google. Protobuf is internal, but should give you an idea that it is not terribly difficult to write a tokenizer yourself. This will not help you if you really want to use Json.NET, except for rigor, of course.
You might want to read and potentially vote / comment on issue 646 in the Json.NET repository, where I asked for "strict mode" as well. (It also offers an alternative approach - although it looks a bit like a hack.)
Jon skeet
source share