[ https://issues.apache.org/jira/browse/GROOVY-11200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778325#comment-17778325 ]
ASF GitHub Bot commented on GROOVY-11200: ----------------------------------------- yuhengfdada commented on PR #1972: URL: https://github.com/apache/groovy/pull/1972#issuecomment-1774046490 With this change, this unit test is failing in `JsonSlurperLaxTest.groovy`: ``` void testArrayOfArrayWithSimpleValues() { assert parser.parseText('[1, 2, 3, ["a", "b", "c", [true, false], "d"], 4]') == [1, 2, 3, ["a", "b", "c", [true, false], "d"], 4] shouldFail(JsonException) { parser.parseText('[') } parser.parseText('[,]') shouldFail(JsonException) { parser.parseText('[1') } parser.parseText('[1,') shouldFail(JsonException) { parser.parseText('[1, 2') } parser.parseText('[1, 2, [3, 4]') } ``` Not sure why the author expected something like `parser.parseText('[1, 2, [3, 4]')` to not fail. Seems like an invalid JSON String. > JsonSlurper parses badly format JSON without throwing exception > --------------------------------------------------------------- > > Key: GROOVY-11200 > URL: https://issues.apache.org/jira/browse/GROOVY-11200 > Project: Groovy > Issue Type: Bug > Components: JSON > Affects Versions: 4.0.14 > Reporter: John Yin > Priority: Major > > JsonSlurper should throw a JsonException when parsing the following input: > {code:json} > """ > { > "a":1, > "b": { > "c":2 > }""" > {code} > > But it parses the string successfully. On the other hand, it does throw a > JsonException when parsing > > {code:json} > """ > { > "a":1, > "b": { > "c":2 > } > """ > {code} > where the ending """ is on a separate line. > > I think it should fail for both. -- This message was sent by Atlassian Jira (v8.20.10#820010)