Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This error is typically seen when using the Scripting for Confluence app with Groovy scripts that utilize JsonSlurper and JsonOutput. This error can occur due to conflicts with dependencies, and it prevents preventing the script from executing.

...

Code Block
languagegroovy
import groovy.json.JsonSlurperClassic

def json = '''
{
   "name": "John Smith",
   "age": 30
}
'''

def slurper = new JsonSlurperClassic()
def parsedJson = slurper.parseText(json)

log.info(parsedJson.name)

In the modified script, we We import the JsonSlurperClassic class instead of the JsonSlurper and JsonOutput classes in the revised script. Then we instantiate a new JsonSlurperClassic object and use it to parse the JSON string.

By using Using JsonSlurperClassic instead of JsonSlurper and JsonOutput, we avoid the dependency conflict that causes the error. This should allow the script to execute without issue.

Info

It is recommended to test Testing this in a test instance first before moving it to production is recommended.