JSON is used everywhere, including:
- PostgreSQL (json/jsonb types)
- Sync rules input (values are normalized to JSON text).
- Sync rule transformations (extracting values, constructing objects in the future)
- Persisting data in the database.
- Sending to the client.
Where we can, JSON data is kept as strings and not parsed. This is so that:
- We don't add parsing / serializing overhead.
- We don't change the data.
Specifically:
- The SQLite type system makes a distinction between INTEGER and REAL values. We try to preserve this.
- Integers in SQLite can be up to 64-bit.
For this, we use a custom parser, and use BigInt for all integers, and number for floats.