[ 
https://issues.apache.org/jira/browse/GROOVY-11200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777487#comment-17777487
 ] 

Paul King commented on GROOVY-11200:
------------------------------------

Groovy has several parser implementations. Some are faster, some are more lax 
than others. A workaround that works for this example is to declare your 
slurper using one of the other implementations, e.g.:
{code:groovy}
new JsonSlurper(type: JsonParserType.CHARACTER_SOURCE)
{code}
It still seems worth fixing. PRs welcome like always of course.

> 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)

Reply via email to