bevry / cson

CoffeeScript-Object-Notation. Same as JSON but for CoffeeScript objects.
Other
1.34k stars 56 forks source link

Parser results inconsistent? #24

Closed lunelson closed 11 years ago

lunelson commented 11 years ago

The CSON example on the front page, with every coffee-script I can find parses to this:

({
  abc: ['a', 'b', 'c'],
  a: {
    b: 'c'
  }
});

and not to this, which is the starting JSON that is shown:

{
    "abc": [
        "a",
        "b",
        "c"
    ],
    "a": {
        "b": "c"
    }
}

Am I missing something? I'd love to be able to get the latter result as it annoys me to keep typing quotation marks.

balupton commented 11 years ago

That's strange. Can you post the exact steps to reproduce. I'll happily fix.

lunelson commented 11 years ago

I guess I've misunderstood it. Vanilla coffee-script recognizes cson but doesn't seem to parse it out to json the way your code does. I'm looking in vain so far, for a way to write and compile cson inside sublime text.

balupton commented 11 years ago

Correct, CoffeeScript outputs code. CSON outputs data.

If sublime text can execute command line code, you can install cson globall npm install -g cson then pipe the data to json2cson to compile it.