summaryrefslogtreecommitdiff
path: root/AK/JsonArray.cpp
blob: 2a877c1df5baa01dbd9391c315d3f65c632b3546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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();
}

}