Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Issue 10914009: Make JSON.stringify call toJson() on objects that it can't serialize. (Closed)

Created:
8 years, 3 months ago by Lasse Reichstein Nielsen
Modified:
8 years ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Make JSON.stringify call toJson() on objects that it can't serialize. The toJson method must return a value that can be directly serialized (a num/String/bool/Null/List/Map value). Clean up of json.dart with more comments and less unnecessary privacy. BUG=4716 Committed: https://code.google.com/p/dart/source/detail?r=12238

Patch Set 1 #

Total comments: 12

Patch Set 2 : Made JSON.length disappear. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+283 lines, -168 lines) Patch
M lib/json/json.dart View 1 11 chunks +214 lines, -165 lines 2 comments Download
M tests/json/json_test.dart View 3 chunks +21 lines, -1 line 0 comments Download
M tools/ddbg.dart View 1 2 chunks +48 lines, -2 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
Lasse Reichstein Nielsen
8 years, 3 months ago (2012-08-30 12:55:19 UTC) #1
Anders Johnsen
LGTM, with comments. https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart File lib/json/json.dart (right): https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart#newcode18 lib/json/json.dart:18: * Parsed JSON values are of ...
8 years, 3 months ago (2012-08-30 14:03:42 UTC) #2
kasperl
Can we still implement this interface with a native JavaScript JSON implementation? https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart File lib/json/json.dart ...
8 years, 3 months ago (2012-08-30 14:14:14 UTC) #3
floitsch
LGTM with previous comments addressed. https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart File lib/json/json.dart (right): https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart#newcode461 lib/json/json.dart:461: // Double values should ...
8 years, 3 months ago (2012-08-30 14:48:29 UTC) #4
Lasse Reichstein Nielsen
I think this new behavior can also be simulated through native JS JSON.stringify, with suitable ...
8 years, 3 months ago (2012-08-31 14:29:18 UTC) #5
Lasse Reichstein Nielsen
On 2012/08/30 14:14:14, kasperl wrote: > Can we still implement this interface with a native ...
8 years, 3 months ago (2012-08-31 14:55:44 UTC) #6
Lasse Reichstein Nielsen
Please check the code in ddbg.dart
8 years, 3 months ago (2012-09-11 13:10:10 UTC) #7
Anders Johnsen
LGTM, thank you Lasse! https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart File lib/json/json.dart (right): https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart#newcode49 lib/json/json.dart:49: * If the object does ...
8 years, 3 months ago (2012-09-11 13:15:46 UTC) #8
Lasse Reichstein Nielsen
https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart File lib/json/json.dart (right): https://chromiumcodereview.appspot.com/10914009/diff/1/lib/json/json.dart#newcode49 lib/json/json.dart:49: * If the object does not support this method, ...
8 years, 3 months ago (2012-09-12 10:19:39 UTC) #9
hausner
8 years ago (2012-12-07 00:39:55 UTC) #10
Message was sent while issue was closed.
I just now see that with this change, JSON.length() went away. I added that. I
can see that it was not efficient, but duplicating the JSON scanning code in
every script that needs this functionality is not a good solution either. I now
have to duplicate it again for the debugger test scripts. Why could it not stay
in the Json library?

Powered by Google App Engine
This is Rietveld 408576698