yinqiwen / pbjson

A fast C++ serialization and de-serialization of Google's protobuf Messages into/from JSON format.
BSD 3-Clause "New" or "Revised" License
156 stars 66 forks source link

pbjson can't pass json number array to protobuf bytes #12

Open kenmafly opened 8 years ago

kenmafly commented 8 years ago

json number array(such as "numb_array":[1,2,3]) parse to protobuf bytes(bytes numb_array;) faild. It seem that protobuf "bytes type return string" while json type is array, not a string

file:pbjson.cpp static int json2field(... ... case FieldDescriptor::CPPTYPE_STRING: { if (json->GetType() != rapidjson::kStringType) { RETURN_ERR(ERR_INVALID_JSON, "Not a string"); ...

yinqiwen commented 8 years ago

u should use 'repeated int32 numb_array;' in proto for this json format.

kenmafly commented 8 years ago

It works:) Waiting the byte array("[1,2,3]") solution.