Issue reported upstream report at https://jira.mariadb.org/browse/MDEV-27151 also happens in rhel8.x mariadb. User would like this issue patched. Problem can be worked around, bug it is preferably to have it corrected in the rhel package.
Fixed by upstream in: https://github.com/MariaDB/server/commit/d48428e99aa7435ff72e2df7da05f35363e90ec3 The first upstream releases containing this fix should be: mariadb-10.5.18 mariadb-10.3.37
Verified on 10.3.39 (expected output from reproducer matches). mariadb-3:10.3.35-1.module+el8.6.0+15949+4ba4ec26: NULL NULL JSON_VALUE('{"nulltest": null}', '$.nulltest') null 1 + NULL NULL 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest') 1 NULL NULL JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a') null mariadb-3:10.3.39-1.module+el8.8.0+19444+aac3c36b: NULL NULL JSON_VALUE('{"nulltest": null}', '$.nulltest') NULL 1 + NULL NULL 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest') NULL NULL NULL JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a') null