title: Posting JSON objects to Symfony 2
body: <p>I'm working on a project using Symfony 2, I've built a bundle to handle all my database services which passes JSON data back and forward.</p>
  
  <p>My Problem/Question: </p>
  
  <ul>
  <li><p>Is it possible to post a straight up JSON object? Currently I'm spoofing a normal form post for my ajax calls by giving the object a name <code>json={"key":"value"}</code> if I don't give it a name I can't seem to get the data from the Symfony request object <code>$JSON = $request-&gt;request-&gt;get('json');</code></p></li>
  <li><p>I want to be able to use the one service bundle to handle both data coming from AJAX calls, or a normal Symfony form. Currently I'm taking the submitted Symfony form, getting the data then using JSON_ENCODE, I just can't work out how to post the data through to my services controller which is expecting request data. </p></li>
  </ul>
  
  <p>To summarise:</p>
  
  <ul>
  <li><p>I want Symfony to accept a JSON post object rather than a form.</p></li>
  <li><p>I want to pass the JSON object between controllers using Request/Response</p></li>
  </ul>
  
  <p>If I'm going about this all wrong, feel free to tell me so!</p>