You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Gustavo de Morais (Jira)" <ji...@apache.org> on 2026/07/23 16:17:00 UTC
[jira] [Created] (FLINK-40225) JSON parsing for json functions accepts trailing content after the first value
Gustavo de Morais created FLINK-40225:
-----------------------------------------
Summary: JSON parsing for json functions accepts trailing content after the first value
Key: FLINK-40225
URL: https://issues.apache.org/jira/browse/FLINK-40225
Project: Flink
Issue Type: Bug
Components: Table SQL / API
Affects Versions: 2.3.0
Reporter: Gustavo de Morais
Assignee: Gustavo de Morais
{{JsonValueContext}} parsing does not reject malformed input when extra content follows the first valid JSON value. Anything after the first value - separated by a space or comma - is silently ignored, and the input is treated as valid.
{code:java}
SELECT 'true, false, null' IS JSON; -- TRUE (expected FALSE)
SELECT '{"1":"Hello", "2":"Goodbye"}, garbage here' IS JSON; -- TRUE (expected FALSE)
SELECT 'true, false, anything at all' IS JSON; -- TRUE (expected FALSE) {code}
Each parses only the first value ({{{}true{}}}, the object, etc.) and drops the rest, so the malformed string passes as valid JSON.
This affects every function built on the shared parser ({{{}IS JSON{}}}, {{{}JSON_LENGTH{}}}, {{{}JSON_VALUE{}}}, {{{}JSON_QUERY{}}}, {{{}JSON_EXISTS{}}}). For example, {{JSON_LENGTH('null, true, false')}} returns {{1}} instead of {{{}NULL{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)