Send bundleId and objectId to javascript

Also use the json module to generate the environemnt
dictionary string. This takes care of a None objectId
cleanly.