Parsing and using Animation Editor JSON

I don’t want to load the JSON file from the server (nor a snipit).

I am trying to figure out how to use the JSON output that the Animation Editor creates as just an object.

This is loading the JSON with the

This is the JSON that the link returns:

[{"name":"move","property":"position","framePerSecond":60,"dataType":1,"loopBehavior":1,"blendingSpeed":0.01,"keys":[{"frame":0,"values":[0,1,0,null,[0,0,0]]},{"frame":50.46360142014612,"values":[0,3.1891140937805176,0,[0,0,0],[0,0,0]]},{"frame":100,"values":[0,1,0,[0,0,0]]}],"ranges":[]}]

This is where I try to use the Javascript Object that comes from the JSON object.

You can do it like below, passing each of the serialized animations in the array to Animation.Parse like ParseFromFileAsync does. :slight_smile:

EDIT: Here’s a more condensed version, using map() for a nice one-line solution. :slight_smile:

3 Likes

Thanks Blake.

I modified it a little so I can skip the JSON.parse step.

This is exactly what I was looking for. Thanks again.

2 Likes