texturepacker - Inserting a new property into JSON -
i understand can insert new properties json so:
var jsonobj = { members: { host: "hostname", viewers: { user1: "value1", user2: "value2", user3: "value3" } } } jsonobj.members.viewers["user4"] = "value4";
but json need work (from texture packer):
var jsonobj = { "frames": { "chaingun.png": { "frame": { "x": 1766, "y": 202, "w": 42, "h": 34 }, "rotated": false, "trimmed": true, "spritesourcesize": { "x": 38, "y": 32, "w": 42, "h": 34 }, "sourcesize": { "w": 128, "h": 128 } } } }
how insert new property "frame"? it's confusing me because of speech marks.
you can chain members so:
jsonobj.frames["chaingun.png"]["frame"]["z"] = 1234; // or jsonobj.frames["chaingun.png"].frame.z = 4567;
json texturepacker
No comments:
Post a Comment