Does JSON.parse() really sort properties when the key names have numeric values?
<p>There's a number of posts here about this issue, and they all contain a lot of assertions that can be summarized like this:</p>

<ol>
<li>Object properties are never guaranteed to be ordered in any way.</li>
<li><code>JSON.parse()</code> never sorts properties in any way.</li>
</ol>

<p>Obviously we tend to have no doubt about #1 above, so we may reasonably expect that, for any operation, properties are processed merely in the order they appear.<br>
<em>[edit, following the @Bergi's comment: or at least they should appear in a random order]</em></p>

<p>Then from that we might especially infer that #2 should be true.</p>

<p>But look at this snippet:<br>
<em>(BTW note: to show the results, snippets below don't use <code>console.log()</code> which may itself change order of the output. Instead objects are iterated by <code>for (key in obj)</code> and the output displayed in the document)</em></p>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var inputs = [
  '{"c": "C", "a": "A", "b": "B"}',
  '{"3": "C", "1": "A", "2": "B"}',
  '{"c": "C", "a": "A", "3": "C", "1": "A", "b": "B", "2": "B"}'
];

for (var i in inputs) {
  var json = inputs[i],
      parsed = JSON.parse(json),
      output = [];
  for (var j in parsed) {
    output.push(j + ': ' + parsed[j]);
  }
  document.write(`JSON: ${json}&lt;br /&gt;Parsed: ${output.join(', ')})&lt;hr /&gt;`);
}</code></pre>
</div>
</div>
</p>

<p>It shows that, given a JSON string having unordered keys:</p>

<ul>
<li>When the input has <strong>keys with non-numeric values</strong>, the parsed object has its <strong>properties in the same order</strong> than in the input. This is consistent with the #2 assumption above.</li>
<li>Conversely when the input has <strong>keys with numeric values</strong> (though they're strings, so not firing parse error), the parsed object has its <strong>properties sorted</strong>. This now contradicts the #2 assumption.</li>
<li>More: when there are <strong>mixed numeric and non-numeric key values</strong>, first appear the <strong>numeric properties sorted</strong>, then the <strong>non-numeric properties in their original order</strong>.</li>
</ul>

<p>From that I was first tempted to conclude that actually there would be a (non-documented?) feature, so <code>JSON.parse()</code> works following the "rules" exposed above.</p>

<p>But I had the idea to look further, so the snippet below now shows how ordered are the properties of a merely coded object:</p>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var objects = [
  [
    '{"c": "C", "a": "A", "b": "B"}',
    {"c": "C", "a": "A", "b": "B"}
  ],
  [
    '{"3": "C", "1": "A", "2": "B"}',
    {"3": "C", "1": "A", "2": "B"}
  ],
  [
    '{"c": "C", "a": "A", "3": "C", "1": "A", "b": "B", "2": "B"}',
    {"c": "C", "a": "A", "3": "C", "1": "A", "b": "B", "2": "B"}
  ]
];

for (var i in objects) {
  var object = objects[i],
      output = [];
  for (var j in object[1]) {
    output.push(j + ': ' + object[1][j]);
  }
  document.write(`Code: ${object[0]}&lt;br /&gt;Object: ${output.join(', ')}&lt;hr /&gt;`);
}</code></pre>
</div>
</div>
</p>

<p>It results in analogue observations, i.e. whichever order they're coded, properties are stored following the 3rd rule above:</p>

<ul>
<li>numerically named properties are all put first, sorted</li>
<li>other properties are set next, ordered as coded</li>
</ul>

<p>So it means that <code>JSON.parse()</code> is not involved: in fact it seems to be a fundamental process of object building.<br>
Again this appears not documented, at least as far I could find.</p>

<p>Any clue for a real, authoritative, rule?</p>

<hr>

<p>[Edit, thanks to @Oriol's answer] It actually appears that, synthetically:</p>

<ul>
<li>This behaviour conforms to an <a href="http://www.ecma-international.org/ecma-262/7.0/#sec-ordinaryownpropertykeys" rel="nofollow">ECMA specification rule</a>.</li>
<li>This rule should apply to all methods where a specific order is guaranteed <em>but is optional for other cases</em>.</li>
<li>However it seems that modern browsers all choose to apply the rule whatever method is involved, hence the apparent contradiction.</li>
</ul>