parseJSONValue takes a reference to an input range, so that it can consume the input and leave any trailing text after the JSON value in the range. For just converting a string to a JSONValue, use toJSONValue instead.

I'll make this more clear in the documentation.

Yes please, because it's hard to understand difference. Maybe it's possible to simplify it more?

Also I get trouble with extracting value:

response = toJSONValue(res.bodyReader.readAllUTF8());   

writeln(to!int(response["code"]));

C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(295,24): Error: template std.c onv.toImpl cannot deduce function from argument types !(int)(VariantN!20u), cand
idates are:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(361,3): std.conv.toImpl (T, S)(S value) if (isImplicitlyConvertible!(S, T) && !isEnumStrToStr!(S, T) &&
!isNullToStr!(S, T))


If I am doing simple:
writeln(response["code"]);

Code produce right result (for example 200)

What value consist in key "code"? It's look like not simple "200". How I can convert it to string or int?


Reply via email to