Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Make KeysTest work better #14

Merged
merged 2 commits into from
Aug 25, 2018
Merged
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
9 changes: 8 additions & 1 deletion Json5/Json5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ private static Json5Value Walk(Json5Container holder, string key, Func<Json5Cont
if (value is Json5Container)
{
Json5Container c = (Json5Container)value;
foreach (string k in c.Keys)
string[] keys = c.Keys.ToArray();
foreach (string k in keys)
{
Json5Value v = Walk(c, k, transformer);
if (v != null)
Expand All @@ -115,6 +116,12 @@ private static Json5Value Walk(Json5Container holder, string key, Func<Json5Cont
}
}

// Special case for holder
if (key == "")
{
return value;
}

return transformer(holder, key, value);
}

Expand Down