| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart.json; | 5 library dart.json; |
| 6 | 6 |
| 7 // JSON parsing and serialization. | 7 // JSON parsing and serialization. |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Error thrown by JSON serialization if an object cannot be serialized. | 10 * Error thrown by JSON serialization if an object cannot be serialized. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 * When the cycle is detected, a [JsonCyclicError] is thrown. | 41 * When the cycle is detected, a [JsonCyclicError] is thrown. |
| 42 */ | 42 */ |
| 43 class JsonCyclicError extends JsonUnsupportedObjectError { | 43 class JsonCyclicError extends JsonUnsupportedObjectError { |
| 44 /** The first object that was detected as part of a cycle. */ | 44 /** The first object that was detected as part of a cycle. */ |
| 45 JsonCyclicError(Object object): super(object); | 45 JsonCyclicError(Object object): super(object); |
| 46 String toString() => "Cyclic error in JSON stringify"; | 46 String toString() => "Cyclic error in JSON stringify"; |
| 47 } | 47 } |
| 48 | 48 |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Parses [json] and build the corresponding parsed JSON value. | 51 * Parses JSON and build the corresponding parsed JSON value. |
| 52 * | 52 * |
| 53 * Parsed JSON values are of the types [num], [String], [bool], [Null], | 53 * Parsed JSON values are of the types [num], [String], [bool], [Null], |
| 54 * [List]s of parsed JSON values or [Map]s from [String] to parsed | 54 * [List]s of parsed JSON values or [Map]s from [String] to parsed |
| 55 * JSON values. | 55 * JSON values. |
| 56 * | 56 * |
| 57 * The optional [revivier] function, if provided, is called once for each | 57 * The optional [revivier] function, if provided, is called once for each |
| 58 * object or list property parsed. The arguments are the property name | 58 * object or list property parsed. The arguments are the property name |
| 59 * ([String]) or list index ([int]), and the value is the parsed value. | 59 * ([String]) or list index ([int]), and the value is the parsed value. |
| 60 * The return value of the revivier will be used as the value of that property | 60 * The return value of the revivier will be used as the value of that property |
| 61 * instead the parsed value. | 61 * instead the parsed value. |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 first = false; | 817 first = false; |
| 818 }); | 818 }); |
| 819 sb.write('}'); | 819 sb.write('}'); |
| 820 seen.removeLast(); | 820 seen.removeLast(); |
| 821 return true; | 821 return true; |
| 822 } else { | 822 } else { |
| 823 return false; | 823 return false; |
| 824 } | 824 } |
| 825 } | 825 } |
| 826 } | 826 } |
| OLD | NEW |