Skip to content
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

JSON parse and stringify should support an optional function argument #5911

Closed
jmesserly opened this issue Oct 15, 2012 · 7 comments
Closed
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert type-enhancement A request for a change that isn't a bug

Comments

@jmesserly
Copy link

See the "replacer" and "reviver" arguments for JavaScript:

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify

... they let you handle your own types.

Apologies if this is a duplicate. I feel like I've reported this before but I couldn't find the original bug.

@DartBot
Copy link

DartBot commented Oct 16, 2012

This comment was originally written by VadimTsus...@gmail.com


In my library I have to implement Mongo Extended JSON, strict mode
I believe this solution would be great for my scenario and the likes.

Vadim Tsushko

@lrhn
Copy link
Member

lrhn commented Oct 16, 2012

Removed Type-Defect label.
Added Type-Enhancement label.

@lrhn
Copy link
Member

lrhn commented Nov 9, 2012

Set owner to @lrhn.

@lrhn
Copy link
Member

lrhn commented Nov 9, 2012

A JS-style "reviver" function is pretty simplistic (only allows you to intercept property/element values, so it will parse an entire object before you get to replace it.


Added Accepted label.

@anders-sandholm
Copy link
Contributor

Removed Library-Json label.
Added Library-Convert label.

@srawlins
Copy link
Member

srawlins commented Aug 1, 2014

This should be closed, yes? JsonDecoder accepts a reviver: https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-convert.JsonDecoder

@lrhn
Copy link
Member

lrhn commented Aug 4, 2014

I believe this is as fixed as it will be.


Added Fixed label.

@jmesserly jmesserly added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert labels Aug 4, 2014
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-convert type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants