Skip to content

Parser fails for non-object, non-array inputs #60

@fulldecent

Description

@fulldecent

Test case

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Clarinet</title>
    <script type="text/javascript">var exports = {};</script>
    <script type="text/javascript" src="../clarinet.js"></script>
    <script type="text/javascript">
    var parser = exports.parser();
    parser.onvalue = function (v) {
      console.log("Value: " + v);
    };
    parser.onkey = function (key) {
      console.log("Key: " + key);
    };
    parser.write('1').close();
    </script>
</script>
</head>
<body>
  Look at the console.
</body>
</html>

Expected outcome

parser.onvalue is called

Actual outcome

Error: Non-whitespace before {[.
Line: 1
Column: 1
Char: 49

Discussion

JSON now allows 123 as a legal value. If clarinet only supports the older version of JSON where this was not legal, then please update the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions