title: Creating new Model entry using json (Rails)
body: <p>In my rails application I am trying to create a new user from a json client.  However, I am a little stuck on what to  send as the json body. The request is properly getting sent to the correct controller, however I keep getting my validations error back as a response.  It says the email and username cant be blank. Am I doing someting wrong?</p>
  
  <p>I am POSTing to this url <em>localhost:3000/users.json</em></p>
  
  <p>I am trying to send this as the json request:</p>
  
  <pre><code>{
   "user":
    {
     "email": "foo@foo.com",
     "username": "noob1",
    }
  }
  </code></pre>
  
  <p>In my create action i have this:</p>
  
  <pre><code> # POST /users
    # POST /users.json
    def create
      @user = User.new(params[:user])
  
      respond_to do |format|
        if @user.save
          format.html { redirect_to @user, notice: 'User was successfully created.' }
          format.json { render json: @user, status: :created, location: @user }
        else
          format.html { render action: "new" }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>Here are my routes:</p>
  
  <pre><code>users GET    /users(.:format)          users#index
            POST   /users(.:format)          users#create
   new_user GET    /users/new(.:format)      users#new
  edit_user GET    /users/:id/edit(.:format) users#edit
       user GET    /users/:id(.:format)      users#show
            PUT    /users/:id(.:format)      users#update
            DELETE /users/:id(.:format)      users#destroy
  </code></pre>