Uploaded image for project: 'Swift'
  1. Swift
  2. SR-9730

JSONDecoder cannot parse string with escaping characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Invalid
    • Component/s: Foundation
    • Labels:

      Description

      I cannot parse the JSON with kind of this value:

      {
          "pattern": "^(?:(http|https):[\\/]{2})(?:www\\.|special\\.)qoo10\\.sg\\/?"
      }
      

       

      JSONDecoder always throw an error: 

      "dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid escape sequence around character xxx." UserInfo={NSDebugDescription=Invalid escape sequence around character xxx.})))"

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              levantAJ Tai Le
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: