thegeorg 0c31d97afd Sync linux-headers instead of using system ones | 1 year ago | |
---|---|---|
.. | ||
CMakeLists.darwin.txt | 0c31d97afd Sync linux-headers instead of using system ones | 1 year ago |
CMakeLists.linux-aarch64.txt | 0c31d97afd Sync linux-headers instead of using system ones | 1 year ago |
CMakeLists.linux.txt | 0c31d97afd Sync linux-headers instead of using system ones | 1 year ago |
CMakeLists.txt | 0c31d97afd Sync linux-headers instead of using system ones | 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 | b455da0978 Restoring authorship annotation for <luckybug@yandex-team.ru>. Commit 2 of 2. | 2 years ago |
json_value.h | a1a503bb8b Restoring authorship annotation for <vdmit@yandex-team.ru>. Commit 2 of 2. | 2 years ago |
json_value_ut.cpp | 74b68813c7 Restoring authorship annotation for <timurguryev@yandex-team.ru>. Commit 2 of 2. | 2 years 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}