* Unserialize a JSON string into this variable. * * This just logs an error if the JSON is invalid. * * @param json - A JSON string.
(json: string)
| 363 | * @param json - A JSON string. |
| 364 | */ |
| 365 | fromJSON(json: string): this { |
| 366 | try { |
| 367 | var obj = JSON.parse(json); |
| 368 | } catch (e) { |
| 369 | logger.error('Unable to parse JSON: ' + json + e); |
| 370 | return this; |
| 371 | } |
| 372 | this.fromJSObject(obj); |
| 373 | return this; |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * Converts this variable into an equivalent JavaScript object. |