title: Preventing duplicates in JSON array in MySQL
body: <p>I have a JSON-typed column in a MySQl table. This column stores an array of integer values, like '[1,2,3]'.</p>
  
  <p>What I want is: when I insert a new value into this array using JSON_ARRAY_INSERT/JSON_ARRAY_APPEND, if the value already exists, simply ignore it.</p>
  
  <p>How can I do this within MySQL? That is, NOT checking duplicates from calling scripts like PHP or Node.js, etc.</p>
  
  <p>Update: I'd prefer to use a built-in MySQL mechanism for this purpose, because if done in external scripts, there would be a small chance that duplicates happen due to race conditions, even if I check against duplicates before storing the data.</p>
  
  <p>Thanks!</p>