Skip to content

Initial work on the JSON5.stringify method - #35

Merged
aeisenberg merged 4 commits into
json5:developfrom
aeisenberg:stringify
Sep 17, 2013
Merged

aeisenberg merged 4 commits into
json5:developfrom
aeisenberg:stringify

Conversation

@aeisenberg

Copy link
Copy Markdown

Here is my work on the stringify method. Basic work is complete and tested. The space argument (3rd) is partially implemented, but disabled until I can fully test. The replacer argument (2nd) is not implemented. I don't plan to implement this one since it seems a bit esoteric to me.

I probably have a few more hours worth of work before I can tidy up the space argument support. But, feedback is welcome up until this point. Thanks.

@aseemk

aseemk commented Jan 28, 2013

Copy link
Copy Markdown
Member

Hey @aeisenberg, sorry for the delay, but I'm finally getting to the backlog of JSON5 issues. I'll look at this really soon now, promise. =) Thanks again for submitting.

@aeisenberg

Copy link
Copy Markdown
Author

Thanks. Let me know if there's anything you need.

@aeisenberg

Copy link
Copy Markdown
Author

Hi, wondering if you can get a chance to look at this PR. I'm using json5 in another project now and it would be nice to use a released version. Thanks.

@aseemk

aseemk commented Sep 14, 2013

Copy link
Copy Markdown
Member

Oh man, I'm sorry @aeisenberg.

I'm clearly not able to be an effective maintainer right now, so I'd like to try something that I read about (but can't find the source for at the moment edit: link; article by @felixge, shown to me by @gasi; thanks guys!): I'd like to give you and other folks who've submitted meaningful pull requests contributor rights to JSON5, so you won't be hindered by me anymore.

(cc @MaxNanasy)

I'd love for JSON5 to remain a cohesive project, which often means minimal and simple, so I do ask that you please still leave "editorial oversight" to me, e.g. let's discuss new features before you implement them. =)

In this particular case, if you want to introduce this, there's a few more things that should happen here:

  • We should update the readme.
  • We should update the changelog.
  • If you want to release an update with this, we should bump the version number also, to 0.3.0.
  • And don't forget to list yourself as a contributor in the package.json5. =)

What do you think?

@aseemk

aseemk commented Sep 14, 2013

Copy link
Copy Markdown
Member

Forgot to mention: nice work on implementing this, and thanks for adding all the tests!

@aseemk

aseemk commented Sep 14, 2013

Copy link
Copy Markdown
Member

Also, to finally address your original comments:

Basic work is complete and tested.

No problem. I think it's fine to have an incomplete implementation, as long as it's clearly documented. (E.g. this JSON5 implementation itself doesn't support Unicode characters in key names yet.)

So let's keep that in mind and document both the readme and changelog appropriately.

The replacer argument (2nd) is not implemented. I don't plan to implement this one since it seems a bit esoteric to me.

It has some utility, and I've seen it used in a few places. E.g. https://gist.github.com/mikeal/2504336

Like the above, that doesn't have to be implemented today, but we should still plan on it I think. The good news is it shouldn't be too hard to (eventually) implement: it's ultimately just calling a function on every key-value pair. =)

But, feedback is welcome up until this point.

The community would be the best source of feedback. Unfortunately at the moment we don't have a channel to easily reach the community. I had started a Google Group way back when, but never shared the link:

https://groups.google.com/group/json5

For now, I'll at least add a comment to the issue requesting this feature, where several people +1'ed, but let's look to make the Google Group a thing going forward. I'll add it to the readme!

Nice work again. =)

@aseemk

aseemk commented Sep 14, 2013

Copy link
Copy Markdown
Member

Sorry for the multiple-comment spam; another thing:

I haven't looked deeply at your implementation, and it looks simple/elegant enough to me, but FYI it might help to look at Douglas Crockford's original implementation as well (if you haven't already) for a reference check:

https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L228

(Not that Doug's original implementation is the best model implementation =D, but JSON5's parse implementation is based directly on his, FWIW. Though there's been talk of changing that…)

@aeisenberg

Copy link
Copy Markdown
Author

Thanks for the commit rights. As you mention, there's still some work to do here. I think the guthub hack might actually work in this case. :) I'll address the documentation and other issues over the next few days.

Andrew Eisenberg and others added 4 commits September 15, 2013 08:23
basic support all available
tests included
space argument partially implemented, but not tested, so currently disabled (throws exception on use)
replacer argument is not implemented (throws exception on use)
* added tests for spaces argument
* testing many more corner cases
* fixed lots of problems
aeisenberg pushed a commit that referenced this pull request Sep 17, 2013
Initial work on the JSON5.stringify method.

All complete.  Fully tested and documented. Will raise issues for remaining work.
@aeisenberg
aeisenberg merged commit 688e4cb into json5:develop Sep 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants