Use a custom json encoder for the metadata fields and decode once the json is
loaded.