Invalid JSON text in argument 2 - json_contains in MySQL 5.7.8

Apparently, it treats integers differently from strings. While json_contains(`column_name`,"1") is a valid call, to check if it contains "ART", you must use json_contains(`column_name`,'"ART"') (note the double quoting).

That resolved my issue!


If your candidate type is string, just add double quotes on your candidate then try again.

json_contains(\`column_name`,'"ART"')

JSON_CONTAINS(target, candidate[, path])


If the column name store tags only (one level array), like ["ART","LIT","SPORTS"]

JSON_CONTAINS(column_name, 'ART', '$')

If the column name store an key-value array like {"tag":"ART","other":"NONE"}

JSON_CONTAINS(column_name, 'ART', '$.tag')

Finally if tag value is inside a parent array, you need to use path like this:

JSON_CONTAINS(column_name, 'ART', '$.parent.tag')

https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html#function_json-contains