title: How can I access the data for the snake object sent through JSON in my params?
body: <p>Using javascript, I make a fetch post.</p>
  
  <pre><code>const game = {name: this.player, snake: this.snake, score: this.score, apple: this.apple, skull: this.skull, completed: this.completed}
          return fetch("http://localhost:3000/games", {
          method: "POST",
          headers: {
              "Content-Type": "application/json"},
              body: JSON.stringify(game)
          })
          .then(resp =&gt; resp.json())
          .then(json =&gt; Game.appendHighScores(json));
  </code></pre>
  
  <p>I access the data via params on the Ruby on Rails end. The data for <code>params[:snake][:body]</code> are supposed to look like <code>"body"=&gt;[{"x"=&gt;16, "y"=&gt;15}, {"x"=&gt;16, "y"=&gt;14}, {"x"=&gt;16, "y"=&gt;15}]}</code>, yet when I type them into the command line, they look like this:</p>
  
  <p><code>[&lt;ActionController::Parameters {"x"=&gt;16, "y"=&gt;15} permitted: false&gt;, &lt;ActionController::Parameters {"x"=&gt;16, "y"=&gt;14} permitted: false&gt;, &lt;ActionController::Parameters {"x"=&gt;16, "y"=&gt;15} permitted: false&gt;]</code></p>
  
  <p>It is accessible via indexing, but I get everything along with the data I'm looking for.</p>
  
  <p>I was hoping it would look like the original params when I typed it in</p>
  
  <p><code>&lt;ActionController::Parameters {"name"=&gt;"Don", "snake"=&gt;{"x"=&gt;16, "y"=&gt;15, "direction"=&gt;"down", "speed"=&gt;0, "directions"=&gt;{"left"=&gt;{"x"=&gt;-1, "y"=&gt;0}, "up"=&gt;{"x"=&gt;0, "y"=&gt;-1}, "right"=&gt;{"x"=&gt;1, "y"=&gt;0}, "down"=&gt;{"x"=&gt;0, "y"=&gt;1}}, "image"=&gt;{}, "body"=&gt;[{"x"=&gt;16, "y"=&gt;15}, {"x"=&gt;16, "y"=&gt;14}, {"x"=&gt;16, "y"=&gt;15}]}, "score"=&gt;0, "apple"=&gt;{"image"=&gt;{}, "x"=&gt;2, "y"=&gt;10}, "skull"=&gt;{"image"=&gt;{}, "x"=&gt;12, "y"=&gt;12}, "completed"=&gt;true, "controller"=&gt;"games", "action"=&gt;"create", "game"=&gt;{"score"=&gt;0, "skull"=&gt;{"image"=&gt;{}, "x"=&gt;12, "y"=&gt;12}, "apple"=&gt;{"image"=&gt;{}, "x"=&gt;2, "y"=&gt;10}, "completed"=&gt;true}} permitted: false&gt;</code></p>
  
  <p>Anyway to get the params as an array without it looking so messy with <code>ActionController::Parameters</code> inside of the element?</p>