Added support for JavaScript-style comments in JSON files and improved t... #804

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
@jlecomte
Contributor

jlecomte commented Nov 28, 2012

JSON does not allow for comments... Maintaining our configuration files, which are starting to get gigantic, is therefore quickly becoming a nightmare! This PR allows for comments in JSON files in Mojito by stripping those files from JavaScript-style comments before passing them to JSON.parse. Also, this PR improves a bit the situation with JSLint, although I noticed JSLint does not like the intentional fallthrough in the switch statement... I like it, personally. We can revisit that later if it turns out to be a problem...

This is a new PR following PR #796 which was made from the develop-perf branch which went away... @lzhan confirmed in a private email that this PR was indeed needed because it seems that files with a .json extension are not parsed by the YAML parser (which may not even support JSON)

@drewfish

This comment has been minimized.

Show comment
Hide comment
@drewfish

drewfish Nov 28, 2012

Contributor

We do intend to support comments in config files, though after 0.5.0GA.

The latest thinking is to support YAML, which is a superset of JSON, and which supports comments. (So, any file that is valid JSON is also valid YAML.) One good resource for testing what YAML supports is the online parser. (Comments start with the # character BTW.)

Contributor

drewfish commented Nov 28, 2012

We do intend to support comments in config files, though after 0.5.0GA.

The latest thinking is to support YAML, which is a superset of JSON, and which supports comments. (So, any file that is valid JSON is also valid YAML.) One good resource for testing what YAML supports is the online parser. (Comments start with the # character BTW.)

@jlecomte

This comment has been minimized.

Show comment
Hide comment
@jlecomte

jlecomte Nov 28, 2012

Contributor

Drew, this would be great for us. What is the ETA to have Mojito fully support YAML?

Contributor

jlecomte commented Nov 28, 2012

Drew, this would be great for us. What is the ETA to have Mojito fully support YAML?

@rwaldura

This comment has been minimized.

Show comment
Hide comment
@rwaldura

rwaldura Nov 28, 2012

Contributor

We're really close, but postponed it till after GA purposefully.

Contributor

rwaldura commented Nov 28, 2012

We're really close, but postponed it till after GA purposefully.

@rwaldura

This comment has been minimized.

Show comment
Hide comment
@rwaldura

rwaldura Nov 28, 2012

Contributor

0.5.1, seeing how close we are.
Sprint after 0.5 GA release.

Contributor

rwaldura commented Nov 28, 2012

0.5.1, seeing how close we are.
Sprint after 0.5 GA release.

@jlecomte

This comment has been minimized.

Show comment
Hide comment
@jlecomte

jlecomte Nov 28, 2012

Contributor

OK, if this feature request is being scheduled for 0.5.1, you may close this PR.

Contributor

jlecomte commented Nov 28, 2012

OK, if this feature request is being scheduled for 0.5.1, you may close this PR.

@drewfish

This comment has been minimized.

Show comment
Hide comment
@drewfish

drewfish Nov 28, 2012

Contributor

Cool. We'll probably leave this PR open for a while, until we've done planning for 0.5.1, to make sure it doesn't get lost.

Contributor

drewfish commented Nov 28, 2012

Cool. We'll probably leave this PR open for a while, until we've done planning for 0.5.1, to make sure it doesn't get lost.

@redonkulus

This comment has been minimized.

Show comment
Hide comment
@redonkulus

redonkulus Dec 1, 2012

Contributor

Not to hijack this PR but have you guys had a chance to look at JSON5? Is a superset of JSON which supports comments, multi line, trailing commas and other things. Obviously performance and other backwards compatibility features would need to be evaluated. However, it keeps the JSON format with the added commenting feature this PR introduces.

https://github.com/aseemk/json5

Contributor

redonkulus commented Dec 1, 2012

Not to hijack this PR but have you guys had a chance to look at JSON5? Is a superset of JSON which supports comments, multi line, trailing commas and other things. Obviously performance and other backwards compatibility features would need to be evaluated. However, it keeps the JSON format with the added commenting feature this PR introduces.

https://github.com/aseemk/json5

@jlecomte

This comment has been minimized.

Show comment
Hide comment
@jlecomte

jlecomte Dec 1, 2012

Contributor

@redonkulus yes, we have. Please see PR #796 for some additional background about this thread.

Contributor

jlecomte commented Dec 1, 2012

@redonkulus yes, we have. Please see PR #796 for some additional background about this thread.

@drewfish drewfish referenced this pull request Jan 11, 2013

Closed

re-enable yaml support #907

caridy added a commit to caridy/mojito that referenced this pull request Jan 11, 2013

@caridy caridy referenced this pull request Jan 11, 2013

Merged

re-enable yaml support #916

@caridy caridy closed this in c278416 Jan 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment