Answers.Body: <p>You can just use PHP's <a href="https://secure.php.net/manual/en/function.echo.php" rel="nofollow noreferrer">echo</a> method to directly output to the browser.</p>
  
  <pre><code>$returnValue = "abc,123";
  echo $returnValue;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-16T18:12:20.330Z
Answers.LastActivityDate: 2016-11-16T18:12:20.330Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>So I realized I can just do die("abc,123") and get the result I need.  I am definitely open to better or more "correct" solutions though.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-16T18:07:40.980Z
Answers.LastActivityDate: 2016-11-16T18:07:40.980Z
Answers.UserDisplayName: Daniel Boggs
Answers.Body: <p>Nothing wrong with a plain old <code>echo()</code> statement, even <code>returnJson()</code> <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/BaseController.php#L324" rel="nofollow noreferrer">essentially just echoes</a> your data (after JSON encoding it, of course).</p>
  
  <p>If it <em>feels</em> better, you can use <code>$this-&gt;renderText('abc,123');</code> – although <a href="https://github.com/yiisoft/yii/blob/1.1.17/framework/web/CController.php#L840" rel="nofollow noreferrer">it'll also basically just call <code>echo()</code></a> for you.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-16T20:14:03.957Z
Answers.LastActivityDate: 2016-11-16T20:14:03.957Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I feel like I'm missing something very obvious, all I need to do is return plain text (not JSON) in response to an action.  If I use <code>returnJson()</code> it returns the value with quotation marks around it.  I'm dealing with a closed system that expects a VERY specific format, so the added quotations cause the submission to fail.</p>
  
  <p>So for added clarification:</p>
  
  <pre><code>$returnValue = "abc,123"
  $this-&gt;returnJson($returnValue)
  </code></pre>
  
  <p>I get: <code>"abc,123"</code></p>
  
  <p>I NEED: <code>abc,123</code></p>
  
Tags: <templating>
Title: Return plain text
ThreadText: # Return plain text
  
  (Asked by: username_0 on 2016-11-16)
  
  I feel like I'm missing something very obvious, all I need to do is return plain text (not JSON) in response to an action. If I use `returnJson()` it returns the value with quotation marks around it. I'm dealing with a closed system that expects a VERY specific format, so the added quotations cause the submission to fail.
  
  So for added clarification:
  
  ```
  $returnValue = "abc,123"
  $this->returnJson($returnValue)
  
  ```
  
  I get: `"abc,123"`
  
  I NEED: `abc,123`
  
  **Tags:** templating
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-11-16. Score: 1
  
  You can just use PHP's [echo](https://secure.php.net/manual/en/function.echo.php) method to directly output to the browser.
  
  ```
  $returnValue = "abc,123";
  echo $returnValue;
  
  ```
  
  
  ---
  
  ### Answer by username_0 on 2016-11-16. Score: 1
  
  So I realized I can just do die("abc,123") and get the result I need. I am definitely open to better or more "correct" solutions though.
  
  
  ---
  
  ### Answer by username_2 on 2016-11-16. Score: 1
  
  Nothing wrong with a plain old `echo()` statement, even `returnJson()` [essentially just echoes](https://github.com/pixelandtonic/Craft-Release/blob/master/app/controllers/BaseController.php#L324) your data (after JSON encoding it, of course).
  
  If it *feels* better, you can use `$this->renderText('abc,123');` – although [it'll also basically just call `echo()`](https://github.com/yiisoft/yii/blob/1.1.17/framework/web/CController.php#L840) for you.
  
  
  ---
  
  