Thursday, 18 May 2017

access json position in nodejs

i have a json in this format:

[
   {
      "Origin":{
         "FtpHost":"info",
         "FtpFolder":"info",
         "FtpUser":"info",
         "FtpPassword":"info",
         "FtpInsideFolder":"info",
         "Pattern":"info"
      },
      "Destination":{
         "FtpHost":"info",
         "FtpFolder":"info",
         "FtpUser":"info",
         "FtpPassword":"info",
         "FtpInsideFolder":"info"
      },
      "CustomFolderName":"Conad",
      "OperationTraverseType":"RootOnly"
   }
]

to pick up the json i wrote this in nodejs:

var fs = require('fs');
var obj = fs.readFileSync('Operations.json', 'utf8');

I'm wondering, how i can access for example : "Destination" fields?

thanks in advance.



via OiRc

No comments:

Post a Comment