I'm trying to send a POST request in JSON via curl in ruby on rails. I would like to know how can I parse this request in a controller and save it in database. I've created controller and model for a player. 

Below is the curl command -

```
curl -i -X POST -H "Content-Type: application/json" "localhost:3000/app/v2/player" -d '{
"url": "app/v2/players.json",
"para": {
    "player": {
        "player_id": 51275,
        "email": "test@gmail.com",
        "total_won": "1890000.00",
        "pr_costs": "29.00",
        "payment_method": "VISA",
        "games": [
            {
                "name": "AvsB",
                "matches": 1,
                "value": 1100,
                "category": "Cricket",
                "subcategory": "Test",
                "tags": [
                    "Aus",
                    "Melbourne"
                ],
                "game_id": 12                   
            },
            {
                "name": "CvsD",
                "matches": 1,
                "value": 790,
                "category": "Cricket",
                "subcategory": "T20",
                "tags": [
                    "T20",
                    "20over",
                    "worldcup"
                ],
                "game_id": 7
            }
        ]
    }
}
}'  

```

Below is my player controller-

```
module App
module V2
    class PlayersController < ApplicationController

  def create

    @player = Player.new(params[[:para][:player][:player_id]].first)
    if @player.save
        render json: @player, status: 201, location: @player

    else
        render json: @player.errors, status: 422
    end
  end

private  

def player_params
  #params.require(:player).permit(:url, :player_id, :email, :total_won, :pr_costs, :payment_method)
  params.fetch(:url,:para, {}).permit(:player_id, :email, :total_won, :pr_costs, :payment_method)

end
    end
end
end

```

Below is my player model -

```
class Player < ActiveRecord::Base
has_many :games, dependent: :destroy
validates :player_id, presence: true
attr_accessor :url,:para

end

```

Currently I'm getting below error while initiating the curl command -

```
 TypeError (no implicit conversion of Symbol into Integer):
 app/controllers/app/v2/players_controller.rb:21:in `[]'
 app/controllers/app/v2/players_controller.rb:21:in `create'

```

Any pointers on how I can read JSON data and create records for players in create function and related games would be appreciated. I've not created the model for games but it'll be similar in structure to JSON data. Also one player has many games and a game will belong to a Player.

Thanks in advance!