解析无 Schema 的二进制协议与字段

POST/wire/decode
公开访问curl裸值兼容

接受 Hex 或 Base64,解析 Protobuf、CBOR、MessagePack 或 ASN.1 DER。Protobuf 的 UTF-8、嵌套消息、ZigZag 与浮点数为可能的解释。 访问类别:匿名 API,可携带 Token 使用独立额度

请求参数

_formatquery
响应格式为 json 或 text;_format=svg 返回 JSON。plain 是 text 的别名。未识别的值继续按 Accept 协商。
string · 可选:json、text
_colorquery
控制 text 响应的 ANSI 颜色。0、false、off、no 关闭;省略或其他值保留。
string · 可选:0、false、off、no

请求体

application/json
data必填
string · 待解析数据,解码后上限为 4096 字节。 · 最短:1 字符 · 最长:12288 字符
format
string · 省略时为 protobuf。 · 可选:protobuf、cbor、msgpack、der
encoding
string · 省略时为 hex。 · 可选:hex、base64

裸值请求体

可直接发送 data 的 JSON 值。需要传入可选字段时,使用 JSON 对象。

响应

application/json

{
  "type": "object",
  "properties": {
    "format": {
      "type": "string",
      "enum": [
        "protobuf",
        "cbor",
        "msgpack",
        "der"
      ]
    },
    "byteLength": {
      "type": "integer"
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "parent": {
            "type": [
              "integer",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "offset": {
            "type": "integer"
          },
          "length": {
            "type": "integer"
          },
          "hex": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": [
                "label",
                "value"
              ]
            }
          }
        },
        "required": [
          "id",
          "parent",
          "label",
          "type"
        ]
      }
    }
  },
  "required": [
    "format",
    "byteLength",
    "nodes"
  ]
}

响应示例

成功响应

curl -sS --json '"0896011202c3a91a020801250000803f"' https://oit.sh/wire/decode
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "format": "protobuf",
  "byteLength": 16,
  "nodes": [
    {
      "id": 0,
      "parent": null,
      "label": "字段 1",
      "type": "VARINT",
      "offset": 0,
      "value": "150",
      "details": [
        {
          "label": "ZigZag sint64",
          "value": "75"
        },
        {
          "label": "int64",
          "value": "150"
        }
      ],
      "length": 3,
      "hex": "089601"
    },
    {
      "id": 1,
      "parent": null,
      "label": "字段 2",
      "type": "LEN",
      "offset": 3,
      "details": [
        {
          "label": "可能的 UTF-8",
          "value": "é"
        }
      ],
      "length": 4,
      "hex": "1202c3a9"
    },
    {
      "id": 2,
      "parent": null,
      "label": "字段 3",
      "type": "LEN",
      "offset": 7,
      "length": 4,
      "hex": "1a020801"
    },
    {
      "id": 3,
      "parent": 2,
      "label": "可能的嵌套消息",
      "type": "Protobuf"
    },
    {
      "id": 4,
      "parent": 3,
      "label": "字段 1",
      "type": "VARINT",
      "offset": 9,
      "value": "1",
      "details": [
        {
          "label": "ZigZag sint64",
          "value": "-1"
        },
        {
          "label": "int64",
          "value": "1"
        }
      ],
      "length": 2,
      "hex": "0801"
    },
    {
      "id": 5,
      "parent": null,
      "label": "字段 4",
      "type": "I32",
      "offset": 11,
      "value": "1065353216",
      "details": [
        {
          "label": "IEEE 754 float32",
          "value": "1"
        }
      ],
      "length": 5,
      "hex": "250000803f"
    }
  ]
}

错误示例

curl -sS --json '{}' https://oit.sh/wire/decode
HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "INVALID_INPUT",
    "message": "参数无效",
    "issues": [
      {
        "location": "body",
        "field": "data",
        "code": "invalid_type",
        "message": "需要 字符串 类型"
      }
    ]
  }
}

curl 访问示例

curl、wget、HTTPie 默认得到 text/plain。示例展示纯文本输出。

命令与输出

curl -sS --json '"0896011202c3a91a020801250000803f"' 'https://oit.sh/wire/decode?_color=0&_format=text'
HTTP 200
content-type: text/plain; charset=utf-8
content-encoding: gzip
cache-control: no-store

format: protobuf
byteLength: 16
nodes:
  - 
    id: 0
    parent: null
    label: 字段 1
    type: VARINT
    offset: 0
    value: 150
    details:
      - 
        label: ZigZag sint64
        value: 75
      - 
        label: int64
        value: 150
    length: 3
    hex: 089601
  - 
    id: 1
    parent: null
    label: 字段 2
    type: LEN
    offset: 3
    details:
      - 
        label: 可能的 UTF-8
        value: é
    length: 4
    hex: 1202c3a9
  - 
    id: 2
    parent: null
    label: 字段 3
    type: LEN
    offset: 7
    length: 4
    hex: 1a020801
  - 
    id: 3
    parent: 2
    label: 可能的嵌套消息
    type: Protobuf
  - 
    id: 4
    parent: 3
    label: 字段 1
    type: VARINT
    offset: 9
    value: 1
    details:
      - 
        label: ZigZag sint64
        value: -1
      - 
        label: int64
        value: 1
    length: 2
    hex: 0801
  - 
    id: 5
    parent: null
    label: 字段 4
    type: I32
    offset: 11
    value: 1065353216
    details:
      - 
        label: IEEE 754 float32
        value: 1
    length: 5
    hex: 250000803f

在线调试

必填
Ctrl / ⌘ + Enter
curl -X POST 'https://oit.sh/wire/decode' \
  -H 'Content-Type: application/json' \
  --data-raw '{"data":"0896011202c3a91a020801250000803f"}'

响应

等待请求

等待发送请求