Problem with JSON Path Extractor stripping quotation marks from JSON and rendering it invalid

640 views
Skip to first unread message

Devin Bost

unread,
Jul 5, 2016, 5:28:03 PM7/5/16
to jmeter-plugins
Hi,

My team is experiencing a show-stopper problem where the JSON Path Extractor is stripping the quotation marks out of our JSON data, which renders the JSON as invalid and impossible to parse. I have tested this issue on version 2.0 and 2.2 of the JSON Plugins, and the result is the same for both. To demonstrate this issue, I created a dummy sampler with the JSON data, and I tested it with both single and double quotation marks. (The outcome was the same for both.) 
You can see here that I put the JSON data in the Response Data field of the dummy sampler.



I then setup the Path extractor:



After I created the appropriate debug sampler, the resulting JSON appears with the quotation marks clearly stripped, which makes the JSON invalid and not valid to parse:




The same problem occurred when using the JSON path extractor with a BeanShell PreProcessor, so the problem was not just isolated to the Dummy Sampler. Also, the problem still occurred when we used double quotations in the JSON response data, so both single and double quotation marks were getting stripped from the JSON.  This problem did not occur when using json-path-0.9.0.jar when running the stock JMeter with JMeterPlugins-ExtraLibs-1.3.1 and JMeterPlugins-Standard-1.3.1, but we cannot use these older versions because it appears that BlazeMeter uses the more recent versions. 


I am happy to help debug the problem if I can get someone to please point me in the right direction of where I should look to debug the Java files. 


Thanks,


Devin

Devin Bost

unread,
Jul 5, 2016, 6:21:35 PM7/5/16
to jmeter-plugins
I copied the test data after compiling jmeter-plugins from source code and ran the testProcess_from_var() test and copied the test JSON from SVAR in that test method and pasted it into a Dummy Sampler and ran it through the Debug Sampler. The results are very interesting. Part of the JSON was parsed correctly, but part of the JSON was incorrect and had the quotation marks stripped.

And here's the problem output in the Debug Sampler:


Here's where in the source code I pulled that JSON data from:



I also attached the photos in case they were hard to see.

-Devin
JMeter_test_data1.PNG
JMeter_test_data3.PNG
JMeter_test_data2.PNG
jmeter_from_source.PNG

Devin Bost

unread,
Jul 5, 2016, 7:10:19 PM7/5/16
to jmeter-plugins
I also noticed that the JSON data is getting transformed from using the ":" character to using the "=" character.



I created a new unit test for the failing piece of code and submitted a pull request here: https://github.com/undera/jmeter-plugins/pull/112

-Devin
JMeter_parsing_issue.png

Andrey Pokhilko

unread,
Jul 6, 2016, 2:57:01 AM7/6/16
to jmeter-...@googlegroups.com
Hi,

Thanks for reporting the issue and even writing unit test for it. I've made the fix and pushed v2.3 into deploy stage. In couple of hours it should become available for upgrade.

Andrey Pokhilko

--
You received this message because you are subscribed to the Google Groups "jmeter-plugins" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmeter-plugin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages