title: Ajax request with using rxjs problems with ampersand
body: <p>I'm using rxjs in my application.</p>
  
  <p>In <strong>package.json</strong> my rxjs dependency is <code>"rxjs": "^5.2.0"</code></p>
  
  <p>From that I'm using the ajax module:</p>
  
  <pre><code>import { ajax } from 'rxjs/observable/dom/ajax'
  </code></pre>
  
  <p>I can't find the documentation for the ajax function.</p>
  
  <p>My code:</p>
  
  <pre><code>let categories = action.payload.subcategories.map(cat =&gt; cat.id)
  let shop = JSON.stringify(action.payload.shop)
  action.payload.categories = JSON.stringify(categories)
  action.payload.shop = shop
  return ajax
    .post('http://192.xxx.xxxx:4000/products', action.payload, {
      'Content-': 'application/json'
    })
  </code></pre>
  
  <p>I'm getting an issue where if the <code>shop</code> object has an ampersand in one of its fields, that breaks the json.stringified object being sent.</p>
  
  <p>How do I allow ampersands in the text fields of the objects being json.stringified without breaking the field?</p>
  
  <p>Do I have to url encode it? It will just mean a bit more work on the back end to decode so I'm looking at my options. </p>
  
  <p><a href="https://stackoverflow.com/a/3319145/3935156">This SO answer</a> seems like an easy way to do it although I'm not using jquery and I don't know how to set request type to data object in the <code>ajax.post</code> function being used.</p>
  
  <p>action.payload:</p>
  
  <p><a href="https://i.stack.imgur.com/vSPjc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vSPjc.png" alt="enter image description here"></a></p>
  
  <p>The actual form data being sent (network tab in developer console)</p>
  
  <p><a href="https://i.stack.imgur.com/tsthV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tsthV.png" alt="enter image description here"></a></p>
  
  <p>I noticed when I used <code>encodeURIComponent()</code> in javascript it did change the payload massively. I have the backend decoding json currently so would like to avoid changing the payload that much if possible. The back end is in Elixir.</p>