Writing and reading shape "user data" in Javascript for Automation

Has anyone here successfully used the ‘user data’ attribute for setting and reading metadata for shapes from JavaScript for Automation? When I try (example below), the keys get converted to numbers, and I have trouble reading the data back.

var card = graffle.Shape({
  origin:[20, 20],
  size: [100, 100],
  fillColor: [1.0, 1.0, 0.0],
  text: "Test",
  userData: {mykey: "my value"}
});
graffle_window.canvas.graphics.push(card);

e.g.

assignment

noteShape.userDataItems.byName('noteFor').value = idShape.toString();

reading needs a final () on value to make it a function call, whereas the property assignment above is plain .value

so something like:

strValue = noteShape.userDataItems.byName('noteFor').value()

See also: