I want something similar way to uncheck 'Use Groovy Sandbox' while using jenkinsfile checked-in into SCM like RTC(not by the check box in jenkins job). I am getting following error please check.
node('rh6') {
 stage('Poll Diployment Status'){
echo "will change it to loop the below command to get deployment status in every 3 seconds untill 'Success' or 'Failure' comes or 30seconds time line finishes."
 sh "curl http://my-rest-api/$\{depId} > deploymentstatus.current"
 def result = jsonParse(readFile('deploymentstatus.current'))
 echo "Status : ${result.DeploymentTaskStatus.DeploymentStatusText}"
} 
 }
@NonCPS
 def jsonParse(def json) {
 new groovy.json.JsonSlurperClassic().parseText(json)
 }
Error while using Jenkinsfile
 org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use new groovy.json.JsonSlurperClassic
 at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectNew(StaticWhitelist.java:187)
 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:130)
 at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:191)
 at org.kohsuke.groovy.sandbox.impl.Checker.checkedConstructor(Checker.java:188)
 at org.kohsuke.groovy.sandbox.impl.Checker$checkedConstructor.callStatic(Unknown Source)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:214)
 at WorkflowScript.jsonParse(WorkflowScript:137)
 at WorkflowScript$jsonParse.call(Unknown Source)
 at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
 at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:151)
 at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)
 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:115)
 at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:149)
 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)
 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:118)
 at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)
 at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
 at WorkflowScript.run(WorkflowScript:114)
 at __cps.transform__(Native Method)