1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-29 18:50:08 +03:00

M #-: Fix VectorAttribute::to_json (#2367)

Co-authored-by: Pavel Czerny <pczerny@opennebula.systems>
(cherry picked from commit 7927059d48763d1b440bfdcd8e5b09e4f93ef820)
This commit is contained in:
Pavel Czerný 2023-08-29 17:49:33 +02:00 committed by Ruben S. Montero
parent 0fc9f457f2
commit ccef45de56
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -88,14 +88,13 @@ void VectorAttribute::to_json(std::ostringstream& s) const
return;
}
auto it = attribute_value.begin();
bool is_first = true;
s << "{";
for (++it; it!=attribute_value.end(); it++)
for (const auto& it : attribute_value)
{
if ( it->first.empty() )
if ( it.first.empty() )
{
continue;
}
@ -109,8 +108,8 @@ void VectorAttribute::to_json(std::ostringstream& s) const
is_first = false;
}
s << "\"" << it->first << "\": ";
one_util::escape_json(it->second, s);
s << "\"" << it.first << "\": ";
one_util::escape_json(it.second, s);
}
s << "}";