How do I have a namespace in file?

97 Views Asked by At

This JSON within a file cannot be parsed:

{
  "facebook": {
    appId: "myAppId",
    appSecret: "myAppSecret"
  }
}

When I use this:

{
  "facebook:appId": "myAppId",
  "facebook:appSecret": "myAppSecret"
}

...the following both return null...

var objFb = nconf.get("facebook");

var appId = nconf.get("facebook:appId");

How do I add a namespace within some JSON within a file?

1

There are 1 best solutions below

0
Felix Kling On BEST ANSWER

Just create valid JSON?

{
  "facebook": {
    "appId": "myAppId",
    "appSecret": "myAppSecret"
  }
}

Keys must be strings.