Make Registry conform to the `json.Marshalable` interface by implementing `MarshalJSON`. In this function, acquire the registry's internal lock before marshaling and returning. (Pieter)