Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript enviroment, Json to protobuf text format #1994

Open
zj91zj opened this issue May 16, 2024 · 0 comments
Open

Javascript enviroment, Json to protobuf text format #1994

zj91zj opened this issue May 16, 2024 · 0 comments

Comments

@zj91zj
Copy link

zj91zj commented May 16, 2024

syntax = "proto2";
package proto;

import "google/protobuf/descriptor.proto";

extend google.protobuf.MessageOptions {
optional string url = 55555;
}

message Graph {
optional string name = 1;
optional string version = 2;
repeated Vehicle vehicle = 11;
}

message Vehicle {
optional string name = 1;
optional string ip = 2;
}

I have a Graph json, for example:
{
name:'1',
version:'1.0.0',
vehicle:[{
name:'vehicle-1',
ip: '127.0.0.1'
},
{
name:'vehicle-2',
ip: '127.0.0.1'
}]
}

is there a tool to transform above json to below protobuf text

name: '1'
version: '1.0.0'
vehicle {
name:'vehicle-1'
ip: '127.0.0.1'
}
vehicle {
name:'vehicle-2'
ip: '127.0.0.1'
}

@zj91zj zj91zj changed the title Json to protobuf text format Javascript enviroment, Json to protobuf text format May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant