Commit f7f34204 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Support JSON lists of strings

parent 55d1a182
Pipeline #18279 failed with stages
in 2 minutes and 45 seconds
......@@ -495,18 +495,24 @@ Requests::Param::Value Requests::Param::_get(double timeout,bool lock,
if (!reader.parse(m_data_buffer, root))
THROW_EIGER_EXCEPTION(eigerapi::JSON_PARSE_FAILED,"");
Value value;
if(root.isArray())
std::string json_type;
bool is_list = root.isArray();
if (!is_list) {
json_type = root.get("value_type", "dummy").asString();
is_list = (json_type == "list");
}
if(is_list)
{
value.type = Requests::Param::STRING_ARRAY;
int array_size = root.size();
Json::Value& array = root.isArray() ? root : root["value"];
int array_size = array.size();
for(int i = 0;i < array_size;++i)
value.string_array.push_back(root[i].asString());
value.string_array.push_back(array[i].asString());
}
else
{
//- supported types by dectris are:
//- bool, float, int, string or a list of float or int
std::string json_type = root.get("value_type", "dummy").asString();
if (json_type == "bool")
{
value.type = Requests::Param::BOOL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment