title: Ruby exception occurred: no implicit conversion of String into Integer in Logstash ruby filter
body: <p>I am getting the Logstash errors:</p>
  
  <pre><code>[2018-10-10T17:24:11,048][ERROR][logstash.filters.ruby    ] Ruby exception occurred: no implicit conversion of String into Integer
  [2018-10-10T17:24:11,049][ERROR][logstash.filters.ruby    ] Ruby exception occurred: no implicit conversion of String into Integer
  [2018-10-10T17:24:11,047][ERROR][logstash.filters.ruby    ] Ruby exception occurred: no implicit conversion of String into Integer
  </code></pre>
  
  <p>My input:</p>
  
  <pre><code>"files": [{
          "SHA256": "1213447D713ECA24484983E754474D9D2F4A283D77DDBD9C8084CD7AA0574ACF",
          "MD5": "7D332F11DD7389C8121AA523F07CFEEC",
          "SHA1": "6026B28C6049115272138AD357A5AF67B99354A5"
      }, {
          "SHA256": "1213447D713ECA24484983E754474D9D2F4A283D77DDBD9C8084CD7AA0574ACF",
          "MD5": "7D332F11DD7389C8121AA523F07CFEEC",
          "SHA1": "6026B28C6049115272138AD357A5AF67B99354A5"
      }, {
          "SHA256": "1212447D713ECA24484983E754474D9D2F4A283D77DDBD9C8084CD7AA0574ACF",
          "MD5": "7D332F11DD7389C8121AA523F07CFEEC",
          "SHA1": "6026B28C6049115272138AD357A5AF67B99354A5"
      }
  ]
  </code></pre>
  
  <p>My code: </p>
  
  <pre><code>a = event.get("files"); event.set("files_md5", a.map { |e| e["MD5"]
  </code></pre>
  
  <p>The code is doing a transformation of the input above to:</p>
  
  <pre><code>"files":["7D332F11DD7389C8121AA523F07CFEEC","7D332F11DD7389C8121AA523F07CFEEC","7D332F11DD7389C8121AA523F07CFEEC"]
  </code></pre>
  
  <p>No data is being dropped because of those errors, however, I would like not to have them. 
  I have tried:</p>
  
  <pre><code>a = event.get("files"); event.set("files_md5", a.map { |e| e["MD5"].to_i 
  </code></pre>
  
  <p>Is there a way to do the implicit conversion correctly in this case?
  Help greatly appreciated.</p>