Background
During the code review for the encoding/json/v2 migration in PR #292, it was identified that we need stricter validation around token types during object parsing.
Description
We need to develop a test case to explicitly confirm that the parser correctly handles unexpected token types. Specifically, if the parser encounters a token type other than EndObject or String at a position where a JSON key is expected, the system must return the appropriate, well-defined error.
This ensures that malformed JSON is caught early and produces a standard error matching previous behavior.
Code Pointers
Metadata
- Priority: P0
- Complexity: Medium
Background
During the code review for the
encoding/json/v2migration in PR #292, it was identified that we need stricter validation around token types during object parsing.Description
We need to develop a test case to explicitly confirm that the parser correctly handles unexpected token types. Specifically, if the parser encounters a token type other than
EndObjectorStringat a position where a JSON key is expected, the system must return the appropriate, well-defined error.This ensures that malformed JSON is caught early and produces a standard error matching previous behavior.
Code Pointers
typed/parser.goreadObjectMetadata