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>
This commit is contained in:
Pavel Czerný 2023-08-29 17:49:33 +02:00 committed by GitHub
parent 40d62686ee
commit 7927059d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 << "}";