Join a json value with a column in postgresql

Square braquets within a json data correspond to an array. You can access any element of the array based on its position starting with 0 for the first element : array->0

So for your query you can do :

from staff s
inner join department d
on d.json -> 'departmentIds'->>0 = s.staffdepartmentID :: text