title: Passing Parameters Using AFNetworking in swift
body: <p><strong>What I did:-</strong></p>
  
  <p>1.I want to call the services using <strong>AFHTTPSessionManager</strong></p>
  
  <p>2.I want to pass the parameters only in <strong>JSON</strong> Format using <strong>POST</strong> method
    and  I have also tried to pass the parameters as <strong>JSON</strong> but I was receiving      <strong>Bad Request</strong> </p>
  
  <p>3.Using AFNetworking 3.0</p>
  
  <ol start="4">
  <li>Referred link <a href="https://stackoverflow.com/questions/29625133/convert-dictionary-to-json-in-swift">Convert Dictionary to JSON in Swift</a>  </li>
  </ol>
  
  <p>MY CODE:-</p>
  
  <pre><code>     dict = ["email_id":user! , "password": pass!]
  
    do {
                  jsonData = try NSJSONSerialization.dataWithJSONObject(dict, options: NSJSONWritingOptions.PrettyPrinted)
                  // here "jsonData" is the dictionary encoded in JSON data
                   theJSONText = String(data: jsonData!,
                                             encoding: NSASCIIStringEncoding)
                  print("json string = \(theJSONText)")
  
  
              } catch let error as NSError {
                  print(error)
              }
  
  
  
       manager.POST(urlString, parameters: theJSONText as String!, success:
                  {
                      requestOperation, response in
  
                      let result = NSString(data: response as! NSData, encoding: NSUTF8StringEncoding)!
  
                      print(result)
                  },
                           failure:
                  {
                      requestOperation, error in
                      //let result = NSString(data: error as! NSData, encoding: NSUTF8StringEncoding)!
  
                      print(error)
  
              })
  </code></pre>
  
  <p>WHAT I WANT TO DO:-
                I want to pass the parameter as JSON Format</p>
  
  <pre><code>      Printing description of theJSONText:
  "{\n  \"email_id\" : \"bbh\",\n  \"password\" : \"vh\"\n}"
  </code></pre>
  
  <p>After Converting to JSON STRING also I'm not getting in JSON Format </p>
  
  <p>please help me to do this..</p>