mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 09:18:05 +03:00
aa3df518e7
And the variant that serializes into a StringBuilder is called serialize().
25 lines
467 B
C++
25 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();
|
|
}
|
|
|
|
}
|