json: Properly handle trailing comma error in object decoding.

Closes #16945