Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Off by one character #2

Closed
jmakeig opened this Issue Mar 25, 2012 · 3 comments

Comments

Projects
None yet
2 participants

jmakeig commented Mar 25, 2012

Using, what I hoped was the simplest set-up, it seems to be parsing, but all of my keys and values are off by one character.

<!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="../lib/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('{ "firstName": "John", "lastName" : "Smith", "age" : 25, "address" : { "streetAddress": "21 2nd Street", "city" : "New York", "state" : "NY", "postalCode" : "10021" }, "phoneNumber": [ { "type" : "home", "number": "212 555-1234" }, { "type" : "fax", "number": "646 555-4567" } ] }').close();
    </script>
</script>
</head>
<body>
  Look at the console.
</body>
</html>

results in

Value: ohn
Key: astName
Value: mith
Key: ge
Value: 25
Key: ddress
Value: 1 2nd Street
Key: ity
Value: ew York
Key: tate
Value: Y
Key: ostalCode
Value: 0021
Key: honeNumber
Value: ome
Key: umber
Value: 12 555-1234
Value: ax
Key: umber
Value: 46 555-4567

This is happening in Chrome 17.0.963.79. Am I doing something dumb?

Owner

dscape commented Mar 26, 2012

I remember a pull request that introduced this problem, but I then fixed it.

Maybe you are using a old version?

I'm going to check the code base now

dscape added a commit that referenced this issue Mar 26, 2012

Owner

dscape commented Mar 26, 2012

Hi Justin,

Thanks for the awesome sample, I've added it to the samples directory and took the liberty of adding you to the contributors.

Screenshot

Will be published as clarinet@0.5.8

Owner

dscape commented Mar 26, 2012

Justin please try the most recent version of clarinet.

Thanks!

@dscape dscape closed this Mar 26, 2012

dscape pushed a commit that referenced this issue Dec 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment