
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Json2proto is a command line tool for converting some json files to protobuf's proto file.
Json2proto is a command line tool for converting some json files to protobuf's proto file.
json2proto���Ѷ���洢json������ļ���Ϊ[ProtoBuf](https://developers.google.com/protocol-buffers/)��proto�ļ���
���������һ��json����
p0 : {
"x" : 0,
"y" : 1
}
�����[ProtoBuf](https://developers.google.com/protocol-buffers/)����ʾ�������Ϳ����������ģ�
message Position1 {
optional int8 x = 1;
optional int8 y = 2;
}
��Ȼ�����������Ҳ���ܴ洢��������, ֻ�Ƕ��˸������ֶ�, �ַ����ͷ�Χ����һЩ���ѡ�
message Position2 {
optional int32 x = 1;
optional int32 y = 2;
optional int32 z = 3;
}
���ͬʱҪ�洢p0�������p1����
p1 : {
x : 0,
y : 1,
z : 2.5
}
��ô��С(�����ֶΣ� ��С��Χ������)�Ŀ���ͬʱ�������������������Ӧ���������ģ�
message Position3 {
optional uint8 x = 1;
optional uint8 y = 2;
optional float z = 3;
}
json2protoͨ�������е������ֶ�_title�� ��ȷ����Щ��������ͬһ�����ͣ� ��������С����������Щ��������͡�
����û��_title�ֶεĶ��� json2proto����ͨ��-a�������Զ����շ���·������_title��
npm install -g json2proto
Usage: json2proto [options] file
Options:
-h, --help Display this information.
-v, --version Print the compiler version.
-o, --output Set the output file name.
-a, --auto Automatically generate a title for unnamed object.
-p, --prefix Set the class name prefix, default prefix is json2proto
-n, --namespace Set the namespace, default namespace is json2proto
-t, --title_tag Specify the title_tag for searching class name, default title is "_title".
motion.json:
{
"rows": [
{
"motion_id": 11001,
"name": "���˼粿�³�",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "����",
"category": "��"
},
{
"motion_id": 11002,
"name": "ֱ��粿�³�",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "����",
"category": "��"
}
]
}
command line:
json2pb -omotion.proto -a motion.json
motion.proto:
syntax = "proto3";
package json2proto ;
message json2proto_motion {
repeated json2proto_motion_rows rows = 1;
}
message json2proto_motion_rows {
int32 motion_id = 1;
string name = 2;
repeated string privileges = 3;
string type = 4;
string category = 5;
}
����ԭʼjson�ļ��в�������_title�ֶΣ� ������-a�������Զ�������
motion.jot
{
"rows": [
{
"motion_id": 11001,
"name": "���˼粿�³�",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "����",
"category": "��",
"_title": "json2proto_motion_rows"
},
{
"motion_id": 11002,
"name": "ֱ��粿�³�",
"privileges": [
"owner",
"admin",
"user",
"guest"
],
"type": "����",
"category": "��",
"_title": "json2proto_motion_rows"
}
],
"_title": "json2proto_motion"
}
FAQs
Json2proto is a command line tool for converting some json files to protobuf's proto file.
The npm package json2proto receives a total of 2 weekly downloads. As such, json2proto popularity was classified as not popular.
We found that json2proto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.