Insert image or object into tree userdata

using tree.setUserData(id, name, value) ,

is it possible to insert an object, rather than a text value ?

While executing command by JS API any type of object can be stored in userdata, but while loading userdata from XML or serialization back to XML - userdata will be threated as string. (  if object was stored , its toString method will be used  )