KineticJS オブジェクト (1 つのプロパティを追加) を JSON にシリアル化しようとしていますが、 を呼び出すとJSON.stringify(test);
、追加されたプロパティのない KineticJS オブジェクトの JSON 表現のみが返されます。どこに問題があるのか 知っている人はいますか?
test = new Kinetic.Line(
{
points : [ 29, 30, 31, 32 ],
stroke : 'black',
strokeWidth : 2,
lineJoin : 'round',
id : '#line'
});
test.obj = "my own property";
JSON.stringify(test);
戻り値
{"attrs":{"points":[{"x":29,"y":30},{"x":31,"y":32}],"stroke":"black","strokeWidth":2,"lineJoin":"round","id":"#line"},
"nodeType":"Shape","shapeType":"Line"}"
しかし、test.obj に関する情報も必要です。