Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ext/json/ext/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ typedef struct JSON_ParserStateStruct {
rvalue_cache name_cache;
int in_array;
int current_nesting;
unsigned int emitted_deprecations;
} JSON_ParserState;

static inline size_t rest(JSON_ParserState *state) {
Expand Down Expand Up @@ -945,7 +946,12 @@ static inline VALUE json_decode_object(JSON_ParserState *state, JSON_ParserConfi
case JSON_IGNORE:
break;
case JSON_DEPRECATED:
emit_duplicate_key_warning(state, json_find_duplicated_key(count, pairs));
// Only emit the first few deprecations to avoid spamming.
if (state->emitted_deprecations < 5) {
emit_duplicate_key_warning(state, json_find_duplicated_key(count, pairs));
state->emitted_deprecations++;
}

break;
case JSON_RAISE:
raise_duplicate_key_error(state, json_find_duplicated_key(count, pairs));
Expand Down
Loading