Add test for duplicate JSON keys for builtins.fromJSON

Related to #1162
Currently if JSON with duplicate object keys is passed into `builtins.toJSON`,
it will silently drop all but the last value, keeping only the last.
This may be surprising, but as this has been consistent reliable behavior that
users might depend on, we should test for it.

Change-Id: Icc2adefabb161530e7cbfa7330919bab6a6a6964
This commit is contained in:
skye
2026-04-18 17:04:48 -04:00
parent 36e784470c
commit 1e986c81ab
2 changed files with 9 additions and 0 deletions
@@ -0,0 +1 @@
{ key = "three"; }
@@ -0,0 +1,8 @@
# Duplicate JSON keys should always drop all but the latest value
builtins.fromJSON ''
{
"key": "one",
"key": "two",
"key": "three"
}
''