Skip to content
MessagePack vs JSON vs Others
step 1/5

Reading — step 1 of 5

Read

~2 min readProduction

MessagePack vs JSON vs Others

FeatureJSONMessagePackProtobufCBORBSON
SchemaNoNoYesNoNo
Wire sizeBiggerSmallSmallerSmallBigger
Speed (encode)SlowFastFastFastFast
Type systemLimitedRich (binary, ext)Rich + customRich (tags)Rich
Browser nativeYes (JSON.parse)No (libs)NoNoNo
Human-readableYesNoNoNoNo
StandardizedRFC 8259specproto3RFC 8949MongoDB
StreamingHardYesYesYesYes

When to use each:

JSON:

  • Public APIs (browser-friendly).
  • Config files (Hjson, JSON5 for human).
  • Logging.
  • Default for most web work.

MessagePack:

  • Internal RPCs where you want JSON-like flexibility but smaller.
  • Caches that need compact serialization.
  • Languages without good Protobuf support.
  • Schemaless storage.

Protobuf:

  • Service-to-service in big systems.
  • Tight schema control + evolution.
  • gRPC.
  • Google + many enterprises.

CBOR:

  • Similar to MsgPack but IETF standardized.
  • Used in some IoT (CoAP).

BSON:

  • MongoDB internal.
  • Larger than MsgPack but typed.

FlatBuffers / Cap'n Proto:

  • Zero-copy access to structured data.
  • Game state, real-time graphics.

Avro:

  • Hadoop / Kafka ecosystems.
  • Schema embedded with data (write).

Performance benchmarks (rough, vary by platform):

  • JSON: 1x baseline.
  • MsgPack encode: 2-3x faster.
  • MsgPack size: 30-50% smaller.
  • Protobuf encode: 3-5x faster than JSON.
  • Protobuf size: 60-80% smaller than JSON.

Picking:

  • Public + browser: JSON.
  • Internal + flexibility: MsgPack.
  • Internal + strict + perf: Protobuf.
  • IoT + standardized: CBOR.

For new internal services: Protobuf is usually the right choice. MsgPack when you need JSON's flexibility minus the verbosity.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…