MCPcopy Index your code
hub / github.com/4ian/GDevelop / fromJSON

Method fromJSON

GDJS/Runtime/variable.ts:365–374  ·  view source on GitHub ↗

* Unserialize a JSON string into this variable. * * This just logs an error if the JSON is invalid. * * @param json - A JSON string.

(json: string)

Source from the content-addressed store, hash-verified

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.

Calls 3

fromJSObjectMethod · 0.95
errorMethod · 0.65
parseMethod · 0.45

Tested by 2