Parse string passed to loadJSON.

This commit is contained in:
anatoly techtonik 2013-03-12 18:19:55 +03:00
parent 38ff681f1b
commit ba7663ff2f

View File

@ -168,6 +168,10 @@ of nodes and edges:
}
**/
// parse if a string is passed (EC5+ browsers)
if (typeof json == 'string' || json instanceof String) {
json = JSON.parse( json );
}
if ('nodes' in json || 'edges' in json) {
this.addNodes.apply(this, json['nodes']);