std.net.curl get json_encode

Andre Pany andre at s-e-a-p.de
Sun Oct 11 09:31:45 UTC 2020


On Sunday, 11 October 2020 at 08:48:16 UTC, Vino wrote:
> On Friday, 9 October 2020 at 17:50:16 UTC, Andre Pany wrote:
>> [...]
>
> Hi Andre,
>
>   Thank you very much, now we are able to get the data as 
> expected using jv["Name"], now when we try to print all the 
> returned data with Key and Values as below it is thorwing an 
> error
>
> Error:
>
> Error: template `object.byKeyValue` cannot deduce function from 
> argument types `!()(JSONValue)`
>
> Code:
>
> string s = cast(string) content;
> JSONValue jv = parseJSONValue(s);
> writeln(jv["Name"];               \\ this works.
> foreach (key, value; jv.byKeyValue) writefln("%s: %s", key, 
> value);  \\ this does not work.
>
> From,
> Vino

As far as I remember:
foreach (key, value; jv.object.byKeyValue)

byKeyValue is a function of an associative array. You get the 
associative array (Json object) of an JSONValue by attribute 
.object.

Kind regards
Andre


More information about the Digitalmars-d-learn mailing list