@@ -31,7 +31,7 @@ inline void to_json(JsonValueScope &jv, const JsonInt64 json_int64) {
31
31
}
32
32
33
33
struct JsonVectorInt64 {
34
- const std:: vector<int64> &value;
34
+ const vector<int64> &value;
35
35
};
36
36
37
37
inline void to_json (JsonValueScope &jv, const JsonVectorInt64 &vec) {
@@ -51,7 +51,7 @@ void to_json(JsonValueScope &jv, const tl_object_ptr<T> &value) {
51
51
}
52
52
53
53
template <class T >
54
- void to_json (JsonValueScope &jv, const std:: vector<T> &v) {
54
+ void to_json (JsonValueScope &jv, const vector<T> &v) {
55
55
auto ja = jv.enter_array ();
56
56
for (auto &value : v) {
57
57
ja.enter_value () << ToJson (value);
@@ -134,14 +134,14 @@ inline Status from_json_bytes(string &to, JsonValue from) {
134
134
}
135
135
136
136
template <class T >
137
- Status from_json (std:: vector<T> &to, JsonValue from) {
137
+ Status from_json (vector<T> &to, JsonValue from) {
138
138
if (from.type () != JsonValue::Type::Array) {
139
139
if (from.type () == JsonValue::Type::Null) {
140
140
return Status::OK ();
141
141
}
142
142
return Status::Error (PSLICE () << " Expected Array, but receive " << from.type ());
143
143
}
144
- to = std:: vector<T>(from.get_array ().size ());
144
+ to = vector<T>(from.get_array ().size ());
145
145
size_t i = 0 ;
146
146
for (auto &value : from.get_array ()) {
147
147
TRY_STATUS (from_json (to[i], std::move (value)));
@@ -150,6 +150,22 @@ Status from_json(std::vector<T> &to, JsonValue from) {
150
150
return Status::OK ();
151
151
}
152
152
153
+ inline Status from_json_bytes (vector<string> &to, JsonValue from) {
154
+ if (from.type () != JsonValue::Type::Array) {
155
+ if (from.type () == JsonValue::Type::Null) {
156
+ return Status::OK ();
157
+ }
158
+ return Status::Error (PSLICE () << " Expected Array, but receive " << from.type ());
159
+ }
160
+ to = vector<string>(from.get_array ().size ());
161
+ size_t i = 0 ;
162
+ for (auto &value : from.get_array ()) {
163
+ TRY_STATUS (from_json_bytes (to[i], std::move (value)));
164
+ i++;
165
+ }
166
+ return Status::OK ();
167
+ }
168
+
153
169
template <class T >
154
170
std::enable_if_t <!std::is_constructible<T>::value, Status> from_json (tl_object_ptr<T> &to, JsonValue from) {
155
171
if (from.type () != JsonValue::Type::Object) {
0 commit comments