Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Create protobuf with json values

is it possible to merge or set protobuf message values with matching json values???

example json:

{id: 1, channel: 2, userIsLogged:true}

and a proto definition:

message ServerResponse {
    int32 id = 1
    Result result = 2
    int32 channel = 3
    bool userExists = 4
    bool userIsLogged =5
}

Is there a tool or proto utility to create the proto message without setting the properties individually?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It depends on which language you are using with Protobuf message. Protobuf has provides some toolkits to parse Proto3 message from Json.

If you are using Java, you could use JsonFormat to parse Json into Protobuf message:

JsonFormat.parser().merge(json_string, builder);

If you are using C++, you could use json_util to parse Json:

#include <google/protobuf/util/json_util.h>
int main(int argc, char** argv){
  ServerResponse sr
  // Parse the json_string into sr.
  google::protobuf::util::JsonParseOptions options;
  JsonStringToMessage(json_string, &sr, options);
}

For other languages, you could check Protobuf reference to find a related toolkit.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda