You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to extract values from json responose in JMeter Post-processor BeanShell.
My sample response is: {"tableName":"users","tagName":"registered","bundleId":33,"tagId":2,"owner":"JMeter","description":"","locked":false,"properties":{"address":"London","name":"John","id":"95","email":"[email protected]"}}
I've tried almost the same code (istead of vars.put is System.out) in Eclipse and everything works fine.
The problem is with this line: for (Member property : properties)
Does JMeter don't read nested class?
Log:
// Debug: field reflect error: bsh.ReflectError: No such field: Member
// Debug: Trying to load class: com.eclipsesource.json.JsonObject$Member
Can't iterate over type: class com.eclipsesource.json.JsonObject : at Line: 21 : in file: inline evaluation of: ``debug(); import com.eclipsesource.json.Json; import com.eclipsesource.json.Json . . . '' : for ( com .eclipsesource .json .JsonObject .Member property : properties ) vars .put ( "p_" + property .getName ( ) , property .getValue ( ) .asString ( ) ) ;
at bsh.BSHEnhancedForStatement.eval(BSHEnhancedForStatement.java:57)
at bsh.BSHBlock.evalBlock(BSHBlock.java:130)
at bsh.BSHBlock.eval(BSHBlock.java:80)
at bsh.BSHBlock.eval(BSHBlock.java:46)
at bsh.BSHTryStatement.eval(BSHTryStatement.java:86)
at bsh.Interpreter.eval(Interpreter.java:645)
at bsh.Interpreter.eval(Interpreter.java:739)
at bsh.Interpreter.eval(Interpreter.java:728)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:166)
at org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:189)
at org.apache.jmeter.util.BeanShellTestElement.processFileOrScript(BeanShellTestElement.java:151)
at org.apache.jmeter.extractor.BeanShellPostProcessor.process(BeanShellPostProcessor.java:64)
at org.apache.jmeter.threads.JMeterThread.runPostProcessors(JMeterThread.java:827)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:517)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254)
at java.lang.Thread.run(Thread.java:745)
The text was updated successfully, but these errors were encountered:
Hi,
I've tried to extract values from json responose in JMeter Post-processor BeanShell.
My sample response is:
{"tableName":"users","tagName":"registered","bundleId":33,"tagId":2,"owner":"JMeter","description":"","locked":false,"properties":{"address":"London","name":"John","id":"95","email":"[email protected]"}}
My BeanShell is:
I've tried almost the same code (istead of vars.put is System.out) in Eclipse and everything works fine.
The problem is with this line:
for (Member property : properties)
Does JMeter don't read nested class?
Log:
// Debug: field reflect error: bsh.ReflectError: No such field: Member
// Debug: Trying to load class: com.eclipsesource.json.JsonObject$Member
Can't iterate over type: class com.eclipsesource.json.JsonObject : at Line: 21 : in file: inline evaluation of: ``debug(); import com.eclipsesource.json.Json; import com.eclipsesource.json.Json . . . '' : for ( com .eclipsesource .json .JsonObject .Member property : properties ) vars .put ( "p_" + property .getName ( ) , property .getValue ( ) .asString ( ) ) ;
The text was updated successfully, but these errors were encountered: