mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 01:08:20 +00:00
fix(json): allow objects with empty keys #25564
Problem: Empty string is a valid JSON key, but json_decode() treats an object with empty key as ":help msgpack-special-dict". #20757 :echo json_decode('{"": "1"}') {'_TYPE': [], '_VAL': [['', '1']]} Note: vim returns `{'': '1'}`. Solution: Allow empty string as an object key. Note that we still (currently) disallow empty keys in object_to_vim() (since7c01d5ff92
):f64e4b43e1/src/nvim/api/private/converter.c (L333-L334)
Fix #20757 Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This commit is contained in:
@@ -5735,8 +5735,7 @@ M.funcs = {
|
||||
Vim value. In the following cases it will output
|
||||
|msgpack-special-dict|:
|
||||
1. Dictionary contains duplicate key.
|
||||
2. Dictionary contains empty key.
|
||||
3. String contains NUL byte. Two special dictionaries: for
|
||||
2. String contains NUL byte. Two special dictionaries: for
|
||||
dictionary and for string will be emitted in case string
|
||||
with NUL byte was a dictionary key.
|
||||
|
||||
@@ -7155,7 +7154,6 @@ M.funcs = {
|
||||
are binary strings).
|
||||
2. String with NUL byte inside.
|
||||
3. Duplicate key.
|
||||
4. Empty key.
|
||||
ext |List| with two values: first is a signed integer
|
||||
representing extension type. Second is
|
||||
|readfile()|-style list of strings.
|
||||
|
Reference in New Issue
Block a user