ladybird/AK/JsonArray.cpp
Andreas Kling aa3df518e7 AK: Rename JsonObject::to_string() and pals to serialized().
And the variant that serializes into a StringBuilder is called serialize().
2019-06-18 09:37:47 +02:00

24 lines
467 B
C++

#include <AK/JsonArray.h>
#include <AK/StringBuilder.h>
namespace AK {
void JsonArray::serialize(StringBuilder& builder) const
{
builder.append('[');
for (int i = 0; i < m_values.size(); ++i) {
m_values[i].serialize(builder);
if (i != size() - 1)
builder.append(',');
}
builder.append(']');
}
String JsonArray::serialized() const
{
StringBuilder builder;
serialize(builder);
return builder.to_string();
}
}