diff --git a/tdutils/td/utils/JsonBuilder.h b/tdutils/td/utils/JsonBuilder.h index d013d9d22..05d245ac1 100644 --- a/tdutils/td/utils/JsonBuilder.h +++ b/tdutils/td/utils/JsonBuilder.h @@ -301,18 +301,6 @@ class JsonScope { JsonScope &operator<<(double x) { return *this << JsonFloat(x); } - template - JsonScope &operator<<(const T *x); // not implemented - template - JsonScope &operator<<(const char (&x)[N]) { - return *this << JsonString(Slice(x)); - } - JsonScope &operator<<(const char *x) { - return *this << JsonString(Slice(x)); - } - JsonScope &operator<<(const string &x) { - return *this << JsonString(Slice(x)); - } JsonScope &operator<<(Slice x) { return *this << JsonString(x); } @@ -401,12 +389,8 @@ class JsonObjectScope : public JsonScope { jb_->print_offset(); *sb_ << "}"; } - template - JsonObjectScope &operator<<(std::pair key_value) { - return (*this)(key_value.first, key_value.second); - } - template - JsonObjectScope &operator()(S &&key, T &&value) { + template + JsonObjectScope &operator()(Slice key, T &&value) { CHECK(is_active()); if (is_first_) { *sb_ << ","; @@ -590,7 +574,7 @@ class JsonValue : public Jsonable { case Type::Object: { auto object = scope->enter_object(); for (auto &key_value : get_object()) { - object(JsonString(key_value.first), key_value.second); + object(key_value.first, key_value.second); } break; } diff --git a/tdutils/test/json.cpp b/tdutils/test/json.cpp index abb488720..effa5e012 100644 --- a/tdutils/test/json.cpp +++ b/tdutils/test/json.cpp @@ -49,7 +49,7 @@ TEST(JSON, object) { JsonBuilder jb(std::move(sb)); auto c = jb.enter_object(); c("key", "value"); - c << std::make_pair("1", 2); + c("1", 2); c.leave(); ASSERT_EQ(jb.string_builder().is_error(), false); auto encoded = jb.string_builder().as_cslice().str();