Fix get_json_object dropping object fields that follow an empty key - #24028
Fix get_json_object dropping object fields that follow an empty key#24028vuule wants to merge 6 commits into
get_json_object dropping object fields that follow an empty key#24028Conversation
parse_name used a zero-length name as the signal that no name was present, so the legal JSON key "" was treated as an absent name and the following colon was left unconsumed. The element-type switch then saw ':' and failed the whole row, making every field after an empty key unreachable. Use parse_string's result code to decide whether a name was present, which distinguishes a present-but-empty name from an absent one.
get_json_object dropping object fields that follow an empty key
|
/ok to test a2330ee |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughJSONPath name parsing now distinguishes absent names from empty-string keys, propagates parsing failures, and requires a colon after parsed names. Tests cover field selection from objects containing empty-string keys in multiple layouts and value types. ChangesJSONPath empty-key handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to JSONPath parsing now correctly handles empty-string object keys, allowing subsequent fields to be retrieved as expected. The implementation and regression coverage address the stated behavior change with no concrete unresolved current-head risk. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Description
get_json_objectused a zero-length name as the signal that no name was present, so the legal JSON key""was indistinguishable from an absent name and the following colon was left unconsumed, leading to failed parsing of the whole row. For example,$.aon{"":0,"a":1}returned null instead of1, while{"a":1,"":0}worked.Checklist