OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library('json'); | 5 #library('json'); |
6 #import('dart:coreimpl'); | 6 #import('dart:coreimpl'); |
7 | 7 |
8 // TODO(jmesserly): this needs cleanup | 8 // TODO(jmesserly): this needs cleanup |
9 // Ideally JS objects could be treated as Dart Maps directly, and then we can | 9 // Ideally JS objects could be treated as Dart Maps directly, and then we can |
10 // really use native JSON.parse and JSON.stringify. | 10 // really use native JSON.parse and JSON.stringify. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (obj is Map<String, Dynamic>) { | 80 if (obj is Map<String, Dynamic>) { |
81 Map<String, Dynamic> map = obj; | 81 Map<String, Dynamic> map = obj; |
82 obj = new Object(); | 82 obj = new Object(); |
83 map.forEach((k, v) => _setValue(obj, k, v)); | 83 map.forEach((k, v) => _setValue(obj, k, v)); |
84 return obj; | 84 return obj; |
85 } | 85 } |
86 throw new IllegalArgumentException('cannot convert "$value" to JSON'); | 86 throw new IllegalArgumentException('cannot convert "$value" to JSON'); |
87 }); | 87 }); |
88 } | 88 } |
89 } | 89 } |
OLD | NEW |