0

I've used Fiddler to capture these HTTP calls. Here's the problem:

I have a HTTP-POST data that looks like below:

enter image description here

Notice how it has many 'employeeIds' and also 'shiftSumIds'.

Now, these Ids are from a previous HTTP response that looks like below:

enter image description here

Is there an easy way to extract those Ids and prepare the POST data? Thanks in advance.

--Ishti

Ishtiaque Hussain
  • 383
  • 1
  • 5
  • 20

1 Answers1

1

Short answer is JSON Path Extractor available via JMeter Plugins which is designed for getting "interesting" values from JSON data. See Using the XPath Extractor in JMeter guide (look for "Parsing JSON" chapter) for installation instructions and some form of JSON Path language reference.

If it is not enough and you will need some assistance in constructing JSON Path query and building HTTP Request from it - please include text version of response and request using i.e. http://paste.org service as reading large amount of text from small screenshot isn't very handy and chance of getting the answer is minimal

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri for your reply. I'd definitely appreciate your help on writing the query. I tried to upload the text in paste.org, but it says my text is too long and cannot process it. I'm trying to upload it in Google doc and will share it. – Ishtiaque Hussain Jun 17 '15 at 19:36
  • Hi Dmitri, I could not even upload the file in Google drive. However, I was able to solve the problem using Beanshell post processor. I got the clue from [this](http://stackoverflow.com/questions/2591098/how-to-parse-json-in-java) stackoverflow post. Thanks! – Ishtiaque Hussain Jun 18 '15 at 22:18
  • I had to install org.jason library first. I've put a Regular Expression extractor to get the whole response into a variable. Then in the next page, I used a beanshell processor to create JSON object from the variable. Then simply used 'getJSONArray', getJSONObject(i)' and 'getInt' methods from the JSON library and StringBuilder from Java to concatenate the Ids. – Ishtiaque Hussain Jun 18 '15 at 22:32