From a4b45be29662ad2bac99fd8a8c878723f0eba3d7 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Wed, 27 Oct 2021 12:44:10 +0100 Subject: [PATCH] RF: Accept non-printable characters in JSON --- fsl/data/image.py | 2 +- fsl/utils/bids.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsl/data/image.py b/fsl/data/image.py index e21ad87c2..80cffb6a9 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -1569,7 +1569,7 @@ def loadMetadata(image): jsonfile = op.join(dirname, '{}.json'.format(basename)) if op.exists(jsonfile): with open(jsonfile, 'rt') as f: - return json.load(f) + return json.load(f, strict=False) return {} diff --git a/fsl/utils/bids.py b/fsl/utils/bids.py index 671fb4c28..61fc12830 100644 --- a/fsl/utils/bids.py +++ b/fsl/utils/bids.py @@ -187,7 +187,7 @@ def isBIDSFile(filename, strict=True): def loadMetadataFile(filename): """Load ``filename`` (assumed to be JSON), returning its contents. """ with open(filename, 'rt') as f: - return json.load(f) + return json.load(f, strict=False) def loadMetadata(filename): -- GitLab