json-to-protobuf-definition
TypeScript icon, indicating that this package has built-in type declarations

2.4.3 • Public • Published

Convert JSON to Protocol Buffer definition

npm version CI codecov dependencies Status devDependencies Status Maintainability

{
  "name": "Mo Kweon",
  "some_property": 1234
}

to

message Root {
  string name = 1;
  int64 some_property = 2;
}

Install

npm install -D json-to-protobuf-definition
yarn add -D json-to-protobuf-definition

How to use

import {
  convertProtoMessageToString,
  parseRootObjectToProtoMessage,
} from "json-to-protobuf-definition";

// obtained from JSON.parse('{"name": "Mark Hahn""}')
const input = {
  name: "Mark Hahn",
};

const message = parseRootObjectToProtoMessage(input);
console.log(convertProtoMessageToString(message));
// message Root {
//   string name = 1;
// }

How to develop

yarn # install dependencies
yarn test # run test
yarn lint # run lint or `yarn lint --fix` to fix the lint issues

Readme

Keywords

none

Package Sidebar

Install

npm i json-to-protobuf-definition

Weekly Downloads

4

Version

2.4.3

License

MIT

Unpacked Size

59.2 kB

Total Files

27

Last publish

Collaborators

  • kkweon