Optionalvalue: any// Simple JSON path query
User.findAll({ where: json('settings', 'theme', 'dark') })
// SQL: WHERE json_extract(settings, '$.theme') = 'dark'
// Nested path
User.findAll({ where: json('data', 'address.city', 'NYC') })
// SQL: WHERE json_extract(data, '$.address.city') = 'NYC'
// With dot notation path (auto-prepended with $)
User.findAll({ where: json('preferences', 'notifications.enabled', true) })
// SQL: WHERE json_extract(preferences, '$.notifications.enabled') = true
// Using with Op.json symbol directly in object
User.findAll({
where: {
settings: { [Op.json('theme')]: 'dark' }
}
})
// SQL: WHERE json_extract(settings, '$.theme') = 'dark'
Helper to create JSON path extraction condition Used for querying JSON/JSONB columns with path-based extraction