Skip to content

Commit eef7a5c

Browse files
committed
Deep setIn with default to object
2 parents bc14d00 + 59c9fe8 commit eef7a5c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Json/Value.elm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,12 @@ setIn pathInJson valueToSet hostValue =
226226

227227
v =
228228
value
229-
|> Result.andThen
229+
|> Result.map
230230
(\vv ->
231231
hostValue
232232
|> getIn p
233233
|> Result.andThen (setProperty key vv)
234+
|> Result.withDefault (ObjectValue [ ( key, vv ) ])
234235
)
235236
in
236237
case thisPath of

0 commit comments

Comments
 (0)