Last active
August 29, 2015 13:57
-
-
Save kazu69/9405825 to your computer and use it in GitHub Desktop.
try cson https://github.com/bevry/cson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cson to json | |
node_modules/cson/bin/cson2json data.cson | |
{"abc":["a","b","c"],"a":{"b":"c"}} | |
node_modules/cson/bin/json2cson data.json | |
{ | |
abc: [ | |
"a" | |
"b" | |
"c" | |
] | |
a: | |
b: "c" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include CSON | |
CSON = require('cson') | |
# Parse a file path | |
result = CSON.parseFileSync('data.cson') # sync | |
console.log result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include CSON | |
CSON = require('cson'); | |
// Parse a file path | |
result = CSON.parseFileSync('data.cson'); // sync | |
console.log(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
# an array | |
abc: [ | |
'a' | |
'b' | |
'c' | |
] | |
# an object | |
a: | |
b: 'c' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "try-cson", | |
"version": "0.0.1", | |
"description": "", | |
"dependencies": { | |
"cson": "^1.4.5" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# node | |
node cson.js | |
{ abc: [ 'a', 'b', 'c' ], a: { b: 'c' } } | |
# coffee | |
coffee cson.coffee | |
{ abc: [ 'a', 'b', 'c' ], a: { b: 'c' } } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment