Skip to content
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
13 changes: 8 additions & 5 deletions std/json.d
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ struct JSONValue
else static if (is(T : string))
{
type_tag = JSON_TYPE.STRING;
store.str = arg;
string t = arg;
() @trusted { store.str = t; }();
}
else static if (isSomeString!T) // issue 15884
{
Expand Down Expand Up @@ -380,29 +381,31 @@ struct JSONValue
type_tag = JSON_TYPE.OBJECT;
static if (is(Value : JSONValue))
{
store.object = arg;
JSONValue[string] t = arg;
() @trusted { store.object = t; }();
}
else
{
JSONValue[string] aa;
foreach (key, value; arg)
aa[key] = JSONValue(value);
store.object = aa;
() @trusted { store.object = aa; }();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not that one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alrighty

}
}
else static if (isArray!T)
{
type_tag = JSON_TYPE.ARRAY;
static if (is(ElementEncodingType!T : JSONValue))
{
store.array = arg;
JSONValue[] t = arg;
() @trusted { store.array = t; }();
}
else
{
JSONValue[] new_arg = new JSONValue[arg.length];
foreach (i, e; arg)
new_arg[i] = JSONValue(e);
store.array = new_arg;
() @trusted { store.array = new_arg; }();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks fine

}
}
else static if (is(T : JSONValue))
Expand Down