Moved some JSON formatting logic into DynamicObject::writeAsJSON
Added methods var::clone() and DynamicObject::clone() for deep-copying objects.
Fix for auto-toggle DrawableButtons not updating their image immediately.