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:
parent
0fc9f457f2
commit
ccef45de56
@ -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 << "}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user