title: How to extract response data JSON and save variable to CSV file in Jmeter
body: <p>I am trying to extract key "count" from response data and write it's value (int) in CSV file.</p>
  
  <p>I have used BeanShell PostProcessor for the same.</p>
  
  <p>Below is script I have used:</p>
  
  <pre><code>count = vars.get("count");
  
  f = new FileOutputStream("file path", true);
  p = new PrintStream(f); 
  this.interpreter.setOut(p); 
  print(count);
  f.close();
  </code></pre>
  
  <p>And JSON sample, I am trying to extract:</p>
  
  <pre><code>{"meta":{"message":"","is_error":false,"count":295,"next":"123","status":1000,"previous":""}
  </code></pre>
  
  <p>Doing this, "null" gets printed in CSV file. </p>
  
  <p>Please let us know what am I missing here?</p>
  
  <p>It supposed to be 295 gets printed in CSV file.</p>