Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Off by one character #2

Closed
jmakeig opened this Issue · 3 comments

2 participants

@jmakeig

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?

@dscape
Owner

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 dscape referenced this issue from a commit
@dscape [test] adds test from #2 eb1e6a0
@dscape
Owner

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

@dscape
Owner

Justin please try the most recent version of clarinet.

Thanks!

@dscape dscape closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.