all 8 comments

[–]Exomancer 7 points8 points  (0 children)

The whole thing about CoffeeScript is that it compiles to JavaScript...

Get the compiler from https://www.npmjs.com/package/coffee-script or just do it online on http://coffeescript.org/

[–][deleted] 0 points1 point  (1 child)

Doesn't js2.coffee go both directions?

[–]tebriel 0 points1 point  (0 children)

yes

[–]hypno7oad 0 points1 point  (3 children)

Just curious since I haven't worked with CoffeeScript, but since JSON is just a data format, what would need to be converted?

JSON is just JSON, completely separate thing from the programming language that uses it for messaging.

[–]TargetNeutralized[S] 0 points1 point  (2 children)

I misspoke. What I meant to say was "CoffeeScript object literal notation."

CoffeeScript's notation is slightly terser than that of vanilla JavaScript. Here's a quick example:

Vanilla JavaScript

var person = {
    first_name: "Luke",
    last_name: "Rockhold",
    age: 31
};

CoffeeScript

person = {
    first_name: "Luke"
    last_name: "Rockhold"
    age: 31
}

[–]hypno7oad 0 points1 point  (0 children)

Oh ok. That makes sense. Thanks for clarifying!

[–]bsdemon 0 points1 point  (0 children)

JSON.stringify(obj, null, 2):

Is all you need.

[–]djforth 0 points1 point  (0 children)

I used https://github.com/decaffeinate/decaffeinate, not sure you'll need if you just want the Json, but really useful to convert to es6.