Rails:Receive POST with JSON array
<p>I'm currently using a controller to receive POST with one json object at a time. And I want it change to receiving the whole array. How can I modify my controller?</p>

<p><strong>Current Controller</strong></p>

<pre><code>def create
  respond_to do |format|

  @targetrecord = TargetRecord.new(targetrecord_params)
  @targetrecord.save

    if @targetrecord.save
      format.json{ render :json =&gt; @targetrecord.to_json ,status: 200 }
    else
      format.json { render json: @targetrecord.errors, status: 404 }
    end

  end
 end
end

def targetrecord_params

  params.require(:targetrecord).permit(:id, :uuid, :manor, :mac, :beacon_type, :longitude, :latitude, :address, :findTime, :rssi, :finderID, :created_at, :updated_at )

end
</code></pre>

<p>I'm sending the POST as below right now</p>

<pre><code>"targetrecord":

{"id":"","name":"",.....}
</code></pre>

<p>And I want to send multiple sets as an array like</p>

<pre><code>"targetrecord":[

{"id":"1","name":"",.....},
{"id":"2","name":"",.....},
....]
</code></pre>

<p>How can I let my controller know that she needs to extract and create one by one? Thanks a lot!</p>