This project has moved. For the latest updates, please go here.

Bugfix in Json.Net

Jan 5, 2009 at 4:11 PM
Edited Jan 5, 2009 at 5:06 PM
We use Json format for configuration files and data storage written by hand. So there are mistakes in the format sometimes and we need to detect them.

We noticed that with Json.Net 3.5b2 and earlier versions, the following:

    "A" : true,
    "B" "hello", // Notice the colon is missing
    "C" : "bye"

will end up as if it was:

    "A" : true,
    "B" : "bye"

which is incorrect parsing. This is due to the MoveTo() function in the code that skips every char until it finds a colon. I added a fix that makes sure it will skip only white spaces, else it will throw an exception.

I did not find an easy way to contact you by email, so I posted on this forum to let you know what I got for the bugfix (the code I added is in bold underlined italic):

private bool MoveTo(char value)
    while (MoveNext())
        if (_currentChar == value)
            return true;

            throw CreateJsonReaderException("Invalid property identifier character: {0}. Line {1}, position {2}.", _currentChar, _currentLineNumber, _currentLinePosition







Sylvain Boissé
Montreal, Canada
Jan 5, 2009 at 5:08 PM
Nevermind, I just noticed there is a bug tracker on the site...
Jan 6, 2009 at 7:10 AM
Good fine. Thanks for point it out.

I've fixed it in the source code and checked it into CodePlex.