Ignoring Comments with a JsonTextReader

Aug 11, 2009 at 10:20 AM

I was wondering if you'd considered adding an option to JsonTextReader and the similar classes that would allow comments in the JSON to be silently discarded?

This would be very helpful to me.


Aug 15, 2009 at 1:21 AM

Why don't you want comments?

You could inherit from JsonTextReader, override Read() and have it call base.Read() again whenever it encounters a comment.

Aug 17, 2009 at 12:27 PM

Good suggestion, have now done that.

I don't want comments since the data I'm parsing may/may not contain comments (most likely not) and it's easier to parse if you can assume there's no comments.