json: Properly handle trailing comma error in object decoding.

Closes #16945
Or I could update `pop` to return the element and use the match?