AlexSm 6d3e410c45 Remove CMakeLists from main (#2032) | 9 месяцев назад | |
---|---|---|
.. | ||
ut | bf0f13dd39 add ymake export to ydb | 1 год назад |
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. | 2 лет назад |
json_ut.cpp | 53354011ef health checker tests | 2 лет назад |
json_value.cpp | e601ca03f8 Y_VERIFY->Y_ABORT_UNLESS at ^l | 1 год назад |
json_value.h | 13004290f7 | 1 год назад |
json_value_ut.cpp | 13004290f7 | 1 год назад |
ya.make | bf0f13dd39 add ymake export to ydb | 1 год назад |
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}