mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
04a8fc9bd7
This patch adds JsonValue, JsonObject and JsonArray. You can use them to build up a JsonObject and then serialize it to a string via to_string(). This patch only implements encoding, no decoding yet.
15 lines
371 B
C++
15 lines
371 B
C++
#include <AK/JsonArray.h>
|
|
#include <AK/StringBuilder.h>
|
|
|
|
String JsonArray::to_string() const
|
|
{
|
|
StringBuilder builder;
|
|
builder.append('[');
|
|
for (int i = 0; i < m_values.size(); ++i) {
|
|
builder.append(m_values[i].to_string());
|
|
if (i != size() - 1)
|
|
builder.append(',');
|
|
}
|
|
builder.append(']');
|
|
return builder.to_string();
|
|
}
|