Some changes to the json serialization to make it work with sharejs properly.