JSON vs JSONB in Postgres

When to use each

TIL

  • jsonb

    • mostly use this

    • has an actual data structure

      • concatenation

      • get nested properties

      • and more!

  • json

    • stores it as plain text with whitespace

    • if you're processing logs and use it more like an audit trail

    • can't do those operations ⬆️

    • converts to dictionaries and actual JSON more nicely

      • instead of a binary string

SO: Difference between jsonb and json