MKGeoJSONDecoder can't parse escaped Double-Quote characters

Number:rdar://FB7670149 Date Originated:2020-04-20
Status:Open Resolved:
Product:MapKit Product Version:13.4
Classification: Reproducible:
Please provide a descriptive title for your feedback:
MKGeoJSONDecoder can't parse escaped Double-Quote characters

Which area are you seeing an issue with?

Please describe the issue and what steps we can take to reproduce it:
When parsing valid GeoJSON data containing escaped double-quotes, the MKGeoJSONDecoder fails with error.

Steps to reproduce:
1. Download and copy the GeoJSON from the Berlin city API server into a String: 
OR use the following GeoJSON data

            "features": [
                    "geometry": {
                        "coordinates": [
                        "type": "Point"
                    "properties": {
                        "description": " \" text in double quotes \" ",
                        "href": "/sen/web/service/liefer-und-abholdienste/index.php/detail/1848",
                        "id": "/sen/web/service/liefer-und-abholdienste/index.php/detail/1848",
                        "title": "1848"
                    "type": "Feature"
            "type": "FeatureCollection"

2. Create a Data object from the string using .utf8 format
3. Create a MKGeoJSONDecoder object
4. Try and parse the data using  `try decoder.decode(data)` in a do..catch block
5. The catch block will report an error saying: “The data couldn’t be read because it isn’t in the correct format.”

If we change the “description” string and remove the escaped double-quotes `“\`, the MKGeoJSONDecoder decodes the data without issue.

The attached practice.playground should show the error when the program is run.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!