#26514·vector

`json` 编解码器: 选项,用于以 base64 格式编码字节值

作者: Danielku15创建于 2026年9月30日更新于 2026年9月30日

codec: json

yaml
sources:
  ws:
    type: websocket
    uri: ws://gnss-server/
sinks:
  archive:
    type: console
    inputs: [ws]
    encoding:
      codec: json

二进制帧d3 00 04 3e d0 80 ff被写成:

{"message":"�\u0000\u0004>Ѐ�","source_type":"websocket","timestamp":"2026-09-30T10:49:14.306264900Z"}

消息字节为ef bf bd 00 04 3e d0 80 ef bf bd:d3和ff变成了U+FFFD,无法恢复。一个真实的48字节RTCM块变成了82个字节,其中包含17个替换字符。文本帧往返不变。

内容来源: vectordotdev/vector