diff --git a/openquake/baselib/hdf5.py b/openquake/baselib/hdf5.py
index <HASH>..<HASH> 100644
--- a/openquake/baselib/hdf5.py
+++ b/openquake/baselib/hdf5.py
@@ -433,10 +433,8 @@ def dumps(dic):
             new[k] = {cls2dotname(v.__class__): dumps(vars(v))}
         elif isinstance(v, dict):
             new[k] = dumps(v)
-        elif isinstance(v, str):
-            new[k] = '"%s"' % v
         else:
-            new[k] = v
+            new[k] = json.dumps(v)
     return "{%s}" % ','.join('\n"%s": %s' % it for it in new.items())
Fixed hdf5.dumps