Search code examples
jsonnode.jsnconf

How do I have a namespace in file?


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?


Solution

  • Just create valid JSON?

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

    Keys must be strings.