Mercurial > hg > orthanc
diff OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp @ 4925:8785d8442f90
skip json comments when loading config
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 24 Feb 2022 17:36:20 +0100 |
parents | 43e613a7756b |
children | 47d734fa30f6 1b76853e1797 |
line wrap: on
line diff
--- a/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Wed Feb 23 16:08:54 2022 +0100 +++ b/OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Thu Feb 24 17:36:20 2022 +0100 @@ -511,6 +511,22 @@ } + void OrthancString::ToJsonWithoutComments(Json::Value& target) const + { + if (str_ == NULL) + { + LogError("Cannot convert an empty memory buffer to JSON"); + ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); + } + + if (!ReadJsonWithoutComments(target, str_)) + { + LogError("Cannot convert some memory buffer to JSON"); + ORTHANC_PLUGINS_THROW_EXCEPTION(BadFileFormat); + } + } + + void MemoryBuffer::DicomToJson(Json::Value& target, OrthancPluginDicomToJsonFormat format, OrthancPluginDicomToJsonFlags flags, @@ -645,7 +661,7 @@ ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); } - str.ToJson(configuration_); + str.ToJsonWithoutComments(configuration_); if (configuration_.type() != Json::objectValue) {