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