| 69 | } |
| 70 | |
| 71 | void TJsonWriter::Write(const TStringBuf& value) { |
| 72 | if (ValidateUtf8 && !IsUtf(value)) { |
| 73 | throw yexception() << "JSON writer: invalid UTF-8"; |
| 74 | } |
| 75 | if (Buf.KeyExpected()) { |
| 76 | Buf.WriteKey(value); |
| 77 | } else { |
| 78 | if (DontEscapeStrings) { |
| 79 | Buf.UnsafeWriteValue(TString("\"") + value + '"'); |
| 80 | } else { |
| 81 | Buf.WriteString(value); |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | void TJsonWriter::WriteNull() { |
| 87 | Buf.WriteNull(); |
no test coverage detected