I recommend that Jasonette supports config files in the hjson format ( http://hjson.org/ )
This would demand a parsing of the config file after downloading it before using it as its used today.
Pure JSON would still work, but errors like an extra ,
after last element in an array would not spoil it all.
Another plus is that the developer can have comments in the config file and comment whole sections out (not possible with JSON)
Update: Inspired by http://nshipster.com/javascriptcore/ I have a feeling it could be implemented without much fuzz with JavaScriptCore
let configfileContent = sameWayToFetchFileAsToday();
do {
let hjsonSrc = try String(contentsOfFile: 'path/to/hjson.js', encoding: NSUTF8StringEncoding)
} catch let error as NSError { print("Error: \(error)") }
let context = JSContext()
context.evaluateScript("var hjson2json = function(hjson){ return JSON.stringify(Hjson.parse(hjson), null, 4); };")
let hjson2json = context.objectForKeyedSubscript("hjson2json")
let configJson = hjson2json.callWithArguments([configfileContent])
You might want to use the hjson.js file from http://hjson.org/js/hjson.js where its already “browserified”.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Hjson, a user interface for JSON
Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself....
Read more >Hjson for JavaScript - GitHub
Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself....
Read more >hjson · PyPI
hjson -py. Hjson, a user interface for JSON. Hjson works with Python 2.5+ and Python 3.3+ (based on simplejson). Installation. pip install hjson....
Read more >hjson - npm
A user interface for JSON.. Latest version: 3.2.2, last published: 2 years ago. Start using hjson in your project by running `npm i...
Read more >serde_hjson - Rust - Docs.rs
What is Hjson? A configuration file format for humans. Relaxed syntax, fewer mistakes, more comments. See http://hjson.org.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
my 2cts: we don’t need hjson
Thanks for the suggestion! Let me look into HJSON. Will keep you posted.