# HG changeset patch # User Sebastien Jodogne # Date 1551342588 -3600 # Node ID 7eb5405b7ed8c096b896c80eba2fc66380997507 # Parent 3e0ad879eba27d59e1ce29db63ed7b592b3fe7ac Enlarge the support of JSON-to-XML conversion in the REST API diff -r 3e0ad879eba2 -r 7eb5405b7ed8 Core/RestApi/RestApiOutput.cpp --- a/Core/RestApi/RestApiOutput.cpp Wed Feb 27 08:14:40 2019 +0100 +++ b/Core/RestApi/RestApiOutput.cpp Thu Feb 28 09:29:48 2019 +0100 @@ -128,9 +128,29 @@ MimeType contentType) { CheckStatus(); - output_.SetContentType(contentType); - output_.Answer(buffer, length); - alreadySent_ = true; + + if (convertJsonToXml_ && + contentType == MimeType_Json) + { + Json::Value json; + Json::Reader reader; + if (reader.parse(reinterpret_cast(buffer), + reinterpret_cast(buffer) + length, json)) + { + AnswerJson(json); + } + else + { + throw OrthancException(ErrorCode_BadFileFormat, + "The REST API tries and answers with an invalid JSON file"); + } + } + else + { + output_.SetContentType(contentType); + output_.Answer(buffer, length); + alreadySent_ = true; + } } void RestApiOutput::Redirect(const std::string& path) diff -r 3e0ad879eba2 -r 7eb5405b7ed8 NEWS --- a/NEWS Wed Feb 27 08:14:40 2019 +0100 +++ b/NEWS Thu Feb 28 09:29:48 2019 +0100 @@ -1,12 +1,19 @@ Pending changes in the mainline =============================== -General -------- -* Orthanc Explorer : when performing a Query/Retrieve operation, the tag - default values are now set to an empty string instead of '*', which allows - to match even if the tag is not present. This allows malformed DICOM files - to be matched, even though they lack required tags such as `PatientSex` +Orthanc Explorer +---------------- + +* If performing a Query/Retrieve operation, the default value for the + tags is set to an empty string instead of '*', which allows to match + even if the tag is not present. This allows malformed DICOM files to + be matched, even though they lack required tags such as "PatientSex" + +Maintenance +----------- + +* Enlarge the support of JSON-to-XML conversion in the REST API + Version 1.5.5 (2019-02-25) ==========================