New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hjson #5
Comments
Thanks for the suggestion! Let me look into HJSON. Will keep you posted. |
OK I've looked into HJSON and it won't be much of a problem to implement, especially since Jasonette already makes use of JavascriptCore in some cases. I actually even started writing code and was almost half done when I started having some questions, so decided to throw them out here first before going forward with this:
I guess I'm having these questions because there definitely are overheads for parsing on the client side. I think this on its own is worth it if I didn't have above questions. But if there aren't many HJSON-returning servers out there, I think it may be a better idea to build the HJSON-to-JSON adapter on the server side and let Jasonette deal with pure JSON. But I'm just a HJSON newbie so please share your thoughts! |
my 2cts: we don't need hjson |
If you have a templatingengine you can just as well produce JSON
Its for the convinience of people who edits things manually. When was the last time you had to edit a multiline field in JSON - it sucks... and tiny aspects about the JSON format as trailing comma makes it harder for new people to get on going. This is for the onboarding of Jasonette. The overhead is minimal, and people generating JSON will not feel any difference. |
Maybe HJSON support should come in the form of "you can use it if you want, but the app only supports JSON" In other words, tooling for using HJSON lives outside JSONETTE, and there's something like a plugin, which can convert those files into regular JSON. keeps the server and app clean, and let's people use what they want. I assume this must already be possible. Let JSON be the assembly language of JASONETTE :) |
@mathiasrw I was going to keep this open for a bit before deciding, but I think we have enough opinions on this and I also came to agree that it's better to do this on the server side.
I totally agree with your point, but I think my point was that we may be able to do this server-side, just like @booc0mtaco said. For example a user could write everything in HJSON, and host it on a pastebin service which internally stores it as HJSON but serves it as JSON using the server-side adapter. I already have a json hosting site for Jasonette apps running, and I can imagine supporting HJSON on the jasonbase site in the future. Actually I have thought about this for the last couple of days and realized some of the actions I already have implemented are relevant to this discussion: https://jasonette.github.io/documentation/actions/#conversion I wrote them during the early development stages of Jason. And if I think about it now, the $convert.html action is super useful and I think it deserves its place as an api. But I'm rethinking whether $convert.rss and $convert.csv should be in the main API set. Because there are a lot of useful data formats we can convert to JSON, but if we start adding them one by one this will become as bloated as regular web browsers. Bottom line: Since all web servers can return JSON, I think it's better to write adapters on the server-side that turns whatever data format into JSON. That way it's much more scalable since we don't have to keep adding conversion features to the Jasonette binary every time we need to. Hope this makes sense! |
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
You might want to use the hjson.js file from http://hjson.org/js/hjson.js where its already "browserified".
The text was updated successfully, but these errors were encountered: