AlexSm 6d3e410c45 Remove CMakeLists from main (#2032) | 9 months ago | |
---|---|---|
.. | ||
ut | bf0f13dd39 add ymake export to ydb | 1 year ago |
README.md | b56bb904dc intermediate changes | 2 years ago |
json.cpp | dfd20cd437 const char* -> TStringBuf | 2 years ago |
json.h | 054d233fbe Restoring authorship annotation for <mpoleg@yandex-team.ru>. Commit 2 of 2. | 2 years ago |
json_ut.cpp | 53354011ef health checker tests | 2 years ago |
json_value.cpp | e601ca03f8 Y_VERIFY->Y_ABORT_UNLESS at ^l | 1 year ago |
json_value.h | 13004290f7 | 1 year ago |
json_value_ut.cpp | 13004290f7 | 1 year ago |
ya.make | bf0f13dd39 add ymake export to ydb | 1 year ago |
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}