![]() |
2 лет назад | |
---|---|---|
.. | ||
CMakeLists.txt | e28946633f Improve SystemCommand check in YDB CLI, KIKIMR-14321 | 3 лет назад |
README.md | b56bb904dc intermediate changes | 2 лет назад |
json.cpp | dfd20cd437 const char* -> TStringBuf | 2 лет назад |
json.h | 054d233fbe Restoring authorship annotation for <mpoleg@yandex-team.ru>. Commit 2 of 2. | 3 лет назад |
json_ut.cpp | 53354011ef health checker tests | 2 лет назад |
json_value.cpp | b455da0978 Restoring authorship annotation for <luckybug@yandex-team.ru>. Commit 2 of 2. | 3 лет назад |
json_value.h | a1a503bb8b Restoring authorship annotation for <vdmit@yandex-team.ru>. Commit 2 of 2. | 3 лет назад |
json_value_ut.cpp | 74b68813c7 Restoring authorship annotation for <timurguryev@yandex-team.ru>. Commit 2 of 2. | 3 лет назад |
JSON writer with no external dependencies, producing output where HTML special characters are always escaped.
Use it like this:
#include <library/cpp/json/writer/json.h>
...
NJsonWriter::TBuf json;
json.BeginList()
.WriteString("<script>")
.EndList();
Cout << json.Str(); // output: ["\u003Cscript\u003E"]
For compatibility with legacy formats where object keys are not quoted, use CompatWriteKeyWithoutQuotes:
NJsonWriter::TBuf json;
json.BeginObject()
.CompatWriteKeyWithoutQuotes("r").WriteInt(1)
.CompatWriteKeyWithoutQuotes("n").WriteInt(0)
.EndObject();
Cout << json.Str(); // output: {r:1,n:0}