ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 1. 释义 将一个protobuf消息转换为JSON格式。 ## 2. 使用方法 ``` ~$ configtxlator proto_decode --type=TYPE [<flags>] ``` 命令标志: ``` --help Show context-sensitive help (also try --help-long and --help-man). --type=TYPE The type of protobuf structure to decode from. For example, 'common.Config'. --input=/dev/stdin A file containing the proto message. --output=/dev/stdout A file to write the JSON document to. ``` ## 3. 示例代码 下面的示例将名为fabric\_block.pb的区块转换为json格式并在stdout输出: ``` ~$ configtxlator proto_decode --input fabric_block.pb --type common.Block ``` 在启动rest服务后,下面的示例使用curl命令通过rest api执行同样的操作: ``` ~$ curl -X POST --data-binary @fabric_block.pb "${CONFIGTXLATOR_URL}/protolator/decode/common.Block" ```