<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Safari 10.1 JSON.parse returns incorrect object for numeric keys with decimal values"
   href="https://bugs.webkit.org/show_bug.cgi?id=170442">170442</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Safari 10.1 JSON.parse returns incorrect object for numeric keys with decimal values
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari 10
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>macOS 10.12
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>martin&#64;cropster.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Additional invalid key/value pairs are added if the object contains numeric keys with a decimal number for the first two keys whose 1st decimal place isn't 0.

JSON.parse('{&quot;0&quot;:97.1,&quot;1000&quot;:96.5,&quot;2000&quot;:96.1,&quot;3000&quot;:97.4,&quot;4000&quot;:90.4}')
<span class="quote">&gt; {0: 97.1, 1: NaN, 2: NaN, 1000: 96.5, 2000: 96.1, 3000: 97.4, 4000: 90.4}</span >
If these are parseable to integers, this doesn't happen.
JSON.parse('{&quot;0&quot;:97.0,&quot;1000&quot;:96.0,&quot;2000&quot;:96.1,&quot;3000&quot;:97.4,&quot;4000&quot;:90.4}')
<span class="quote">&gt; {0: 97, 1000: 96, 2000: 96.1, 3000: 97.4, 4000: 90.4}</span >
Nor does the problem occur if we replace the numeric values with strings.
JSON.parse('{&quot;0&quot;:&quot;97.1&quot;,&quot;1000&quot;:&quot;96.5&quot;,&quot;2000&quot;:&quot;96.1&quot;,&quot;3000&quot;:&quot;97.4&quot;,&quot;4000&quot;:&quot;90.4&quot;}')
<span class="quote">&gt; {0: &quot;97.1&quot;, 1000: &quot;96.5&quot;, 2000: &quot;96.1&quot;, 3000: &quot;97.4&quot;, 4000: &quot;90.4&quot;}</span ></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>