This seems a rather clumsy way to convert a container to an object - does our JSON API not have some cleaner way to do it ?  I would hope for a JsonContainerAsObject() that does the create/merge/destroy(temp) part, saving you one temp here ...

... but hey, if that's the API we have, OK, do it the way it supports.