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

Ramesh Venkitaswaran commented on GROOVY-11748:
-----------------------------------------------

Attached
{noformat}
 {
    "@context": [
        "https://geojson.org/geojson-ld/geojson-context.jsonld";,
        {
            "@version": "1.1",
            "wx": "https://api.weather.gov/ontology#";,
            "geo": "http://www.opengis.net/ont/geosparql#";,
            "unit": "http://codes.wmo.int/common/unit/";,
            "@vocab": "https://api.weather.gov/ontology#";
        }
    ],
    "type": "Feature",
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [
                    -97.1080999,
                    39.7227
                ],
                [
                    -97.10849999999999,
                    39.744800000000005
                ],
                [
                    -97.13719999999999,
                    39.744400000000006
                ],
                [
                    -97.1367999,
                    39.72240000000001
                ],
                [
                    -97.1080999,
                    39.7227
                ]
            ]
        ]
    },
    "properties": {
        "units": "us",
        "forecastGenerator": "BaselineForecastGenerator",
        "generatedAt": "2025-08-31T20:20:45+00:00",
        "updateTime": "2025-08-31T20:10:38+00:00",
        "validTimes": "2025-08-31T14:00:00+00:00/P7DT11H",
        "elevation": {
            "unitCode": "wmoUnit:m",
            "value": 456.8952
        },
        "periods": [
            {
                "number": 1,
                "name": "This Afternoon",
                "startTime": "2025-08-31T15:00:00-05:00",
                "endTime": "2025-08-31T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 73,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 38
                },
                "windSpeed": "5 mph",
                "windDirection": "E",
                "icon": 
"https://api.weather.gov/icons/land/day/tsra,40?size=medium";,
                "shortForecast": "Scattered Showers And Thunderstorms",
                "detailedForecast": "Scattered showers and thunderstorms. 
Mostly cloudy, with a high near 73. East wind around 5 mph. Chance of 
precipitation is 40%."
            },
            {
                "number": 2,
                "name": "Tonight",
                "startTime": "2025-08-31T18:00:00-05:00",
                "endTime": "2025-09-01T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 61,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 45
                },
                "windSpeed": "5 mph",
                "windDirection": "E",
                "icon": 
"https://api.weather.gov/icons/land/night/tsra,40/tsra,50?size=medium";,
                "shortForecast": "Scattered Showers And Thunderstorms",
                "detailedForecast": "Scattered showers and thunderstorms. 
Cloudy, with a low around 61. East wind around 5 mph. Chance of precipitation 
is 50%."
            },
            {
                "number": 3,
                "name": "Labor Day",
                "startTime": "2025-09-01T06:00:00-05:00",
                "endTime": "2025-09-01T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 72,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 52
                },
                "windSpeed": "0 to 10 mph",
                "windDirection": "NE",
                "icon": 
"https://api.weather.gov/icons/land/day/tsra,50?size=medium";,
                "shortForecast": "Chance Showers And Thunderstorms",
                "detailedForecast": "A chance of showers and thunderstorms. 
Mostly cloudy, with a high near 72. Northeast wind 0 to 10 mph. Chance of 
precipitation is 50%."
            },
            {
                "number": 4,
                "name": "Monday Night",
                "startTime": "2025-09-01T18:00:00-05:00",
                "endTime": "2025-09-02T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 58,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 32
                },
                "windSpeed": "5 to 10 mph",
                "windDirection": "NE",
                "icon": 
"https://api.weather.gov/icons/land/night/tsra,30/tsra,20?size=medium";,
                "shortForecast": "Chance Showers And Thunderstorms",
                "detailedForecast": "A chance of showers and thunderstorms 
before 3am. Mostly cloudy, with a low around 58. Northeast wind 5 to 10 mph. 
Chance of precipitation is 30%."
            },
            {
                "number": 5,
                "name": "Tuesday",
                "startTime": "2025-09-02T06:00:00-05:00",
                "endTime": "2025-09-02T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 73,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 7
                },
                "windSpeed": "5 mph",
                "windDirection": "NE",
                "icon": 
"https://api.weather.gov/icons/land/day/sct?size=medium";,
                "shortForecast": "Mostly Sunny",
                "detailedForecast": "Mostly sunny, with a high near 73. 
Northeast wind around 5 mph."
            },
            {
                "number": 6,
                "name": "Tuesday Night",
                "startTime": "2025-09-02T18:00:00-05:00",
                "endTime": "2025-09-03T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 57,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 4
                },
                "windSpeed": "0 to 5 mph",
                "windDirection": "S",
                "icon": 
"https://api.weather.gov/icons/land/night/few?size=medium";,
                "shortForecast": "Mostly Clear",
                "detailedForecast": "Mostly clear, with a low around 57. South 
wind 0 to 5 mph."
            },
            {
                "number": 7,
                "name": "Wednesday",
                "startTime": "2025-09-03T06:00:00-05:00",
                "endTime": "2025-09-03T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 76,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 31
                },
                "windSpeed": "5 to 10 mph",
                "windDirection": "NW",
                "icon": 
"https://api.weather.gov/icons/land/day/rain_showers,20/tsra_hi,30?size=medium";,
                "shortForecast": "Slight Chance Rain Showers then Chance 
Showers And Thunderstorms",
                "detailedForecast": "A slight chance of rain showers between 
7am and 1pm, then a chance of showers and thunderstorms. Mostly sunny, with a 
high near 76. Northwest wind 5 to 10 mph. Chance of precipitation is 30%."
            },
            {
                "number": 8,
                "name": "Wednesday Night",
                "startTime": "2025-09-03T18:00:00-05:00",
                "endTime": "2025-09-04T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 48,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 31
                },
                "windSpeed": "5 to 10 mph",
                "windDirection": "N",
                "icon": 
"https://api.weather.gov/icons/land/night/tsra_hi,30/sct?size=medium";,
                "shortForecast": "Chance Showers And Thunderstorms then Partly 
Cloudy",
                "detailedForecast": "A chance of showers and thunderstorms 
before 7pm. Partly cloudy, with a low around 48. North wind 5 to 10 mph. Chance 
of precipitation is 30%."
            },
            {
                "number": 9,
                "name": "Thursday",
                "startTime": "2025-09-04T06:00:00-05:00",
                "endTime": "2025-09-04T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 69,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 12
                },
                "windSpeed": "5 mph",
                "windDirection": "NW",
                "icon": 
"https://api.weather.gov/icons/land/day/sct?size=medium";,
                "shortForecast": "Mostly Sunny",
                "detailedForecast": "Mostly sunny, with a high near 69. 
Northwest wind around 5 mph."
            },
            {
                "number": 10,
                "name": "Thursday Night",
                "startTime": "2025-09-04T18:00:00-05:00",
                "endTime": "2025-09-05T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 54,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 11
                },
                "windSpeed": "5 mph",
                "windDirection": "SW",
                "icon": 
"https://api.weather.gov/icons/land/night/few?size=medium";,
                "shortForecast": "Mostly Clear",
                "detailedForecast": "Mostly clear, with a low around 54."
            },
            {
                "number": 11,
                "name": "Friday",
                "startTime": "2025-09-05T06:00:00-05:00",
                "endTime": "2025-09-05T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 74,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 11
                },
                "windSpeed": "5 to 10 mph",
                "windDirection": "NW",
                "icon": 
"https://api.weather.gov/icons/land/day/few?size=medium";,
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 74."
            },
            {
                "number": 12,
                "name": "Friday Night",
                "startTime": "2025-09-05T18:00:00-05:00",
                "endTime": "2025-09-06T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 48,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 4
                },
                "windSpeed": "5 mph",
                "windDirection": "N",
                "icon": 
"https://api.weather.gov/icons/land/night/skc?size=medium";,
                "shortForecast": "Clear",
                "detailedForecast": "Clear, with a low around 48."
            },
            {
                "number": 13,
                "name": "Saturday",
                "startTime": "2025-09-06T06:00:00-05:00",
                "endTime": "2025-09-06T18:00:00-05:00",
                "isDaytime": true,
                "temperature": 73,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 6
                },
                "windSpeed": "5 mph",
                "windDirection": "NE",
                "icon": 
"https://api.weather.gov/icons/land/day/few?size=medium";,
                "shortForecast": "Sunny",
                "detailedForecast": "Sunny, with a high near 73."
            },
            {
                "number": 14,
                "name": "Saturday Night",
                "startTime": "2025-09-06T18:00:00-05:00",
                "endTime": "2025-09-07T06:00:00-05:00",
                "isDaytime": false,
                "temperature": 52,
                "temperatureUnit": "F",
                "temperatureTrend": "",
                "probabilityOfPrecipitation": {
                    "unitCode": "wmoUnit:percent",
                    "value": 18
                },
                "windSpeed": "5 mph",
                "windDirection": "SE",
                "icon": 
"https://api.weather.gov/icons/land/night/few/tsra_hi,20?size=medium";,
                "shortForecast": "Mostly Clear then Slight Chance Showers And 
Thunderstorms",
                "detailedForecast": "A slight chance of showers and 
thunderstorms after 1am. Mostly clear, with a low around 52."
            }
        ]
    }
}
{noformat}

> Groovy JsonSlurper returns null
> -------------------------------
>
>                 Key: GROOVY-11748
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11748
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>            Reporter: Ramesh Venkitaswaran
>            Priority: Major
>
> When I run my test script against Groovy 5.0.0, this returns null, whereas 
> the same script runs correctly against Groovy 4.0.28 
> {code:groovy}
> import groovy.json.*
> def url = 'https://api.weather.gov/gridpoints/TOP/31,80/forecast'
> def response = new URL(url).text
> def weather = new JsonSlurper().parseText(response)
> assert weather.properties.periods != null
> {code}
> In 5.0.0, this returns (partially reproduced), whereas in 4.0.28 it correctly 
> returns the map of the parsed json.
> {noformat}
> Exception thrown
> Assertion failed: 
> assert weather.properties.periods != null
>        |       |          |       |
>        |       |          null    false
>        |       ['JDK_MAP_ALTHASHING_SYSPROP':null, 'map':null, 'size':4, 
> 'keys':['@context', 'type', 'geometry', 'properties', null], 
> 'values':[['https://geojson.org/geojson-ld/geojson-context.jsonld', 
> ['@version':'1.1',
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to