JSON

By far, the most common message envelope utilizes JSON.

And for good reason:

  • It is simple

  • It is well supported in virtually all programming languages

  • And is mostly human readable

Choosing JSON for your message envelope is (probably) a good idea if:

  • You are adding asynchronous elements to an existing system

  • You are interfacing with many different programming languages

  • Establishing new standards in your org is difficult

JSONcomes with its fair share of CONS though:

  • No type safety

  • Schema-enforcement is not easy

    • This can be alleviated by using something like JSON Schema but that will require org-wide adoption for it to be effective

  • Without schema-enforcement, you are more likely to end up with events that are missing critical event data (ie. team B forgot to fill out the "payment_source" field)

  • No built-in compression; this will influence:

    • message transfer speed

    • bandwidth usage

    • storage cost

  • No automatic client or server code generation

Batch supports JSON and does automatic schema inference.

Last updated