Json Help
    Vino 
    akashvino79 at gmail.com
       
    Sun Sep 10 11:06:03 UTC 2023
    
    
  
Hi All,
   Request your help on the below code,I am trying to convert the 
below string to json and it always throws the error, if the below 
can be accomplished with any other json package even that is 
fine, I tired only the std.json package.
Test Program: Works
````
import std.json;
import std.stdio: writeln;
void main () {
auto sadrsJson = parseJSON(`{ "TestHost": { "Building1": { 
"RackNo": 123}}}`);
writeln(sadrsJson);
}
```
Program: Does not Work
```
import std.json;
import std.stdio;
import std.container;
import std.socket: Socket;
import std.stdio: writeln;
void main () {
string host = Socket.hostName;
string registry = "Test"
Array!string output;
Array!string errors;
output.insertBack("TESTOUTPUT");
errors.insertBack("TESTERRORS");
auto sadrsJson = parseJSON({ host: { registry: { "OUTPUT": 
output[], "ERROR": errors[]}}});
writeln(sadrsJson);
}
From,
Vino.B
    
    
More information about the Digitalmars-d-learn
mailing list