Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5144

JsonSlurper does not handle backslashes at the end of a String

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4
    • 1.8.6, 2.0-beta-3
    • JSON
    • None
    • Ubuntu Linux 11.10 32-bit,

      OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
      OpenJDK Server VM (build 20.0-b11, mixed mode)

    Description

      Whenever I try to deserialize a JSON Object with a String that ends with a correctly escaped backslash "
      ", it throws an exception:

      Caught: groovy.json.JsonException: Expected a value on line: 1, column: 25.
      But got an unterminated object.
      groovy.json.JsonException: Expected a value on line: 1, column: 25.
      But got an unterminated object.
      at JsonSlurperBug.run(JsonSlurperBug.groovy:9)

      I've attached a small repro.

      Attachments

        1. JsonSlurperBug.groovy
          0.3 kB
          Gabriel Szlechtman

        Activity

          People

            guillaume Guillaume Sauthier
            gabrielsz Gabriel Szlechtman
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: