Skip to content

Unable to parse YAML array from Cloud config #81

@4sujittiwari

Description

@4sujittiwari

Below is my cloud-config in YAML format :

 cert:
  abc:
    us:
      usesExclusion: false
      included: [
         '1149043', 
         '1127938', 
         '13658', 
         '107076'
       ]

When the above YAML is parsed in my node app as JSON

{
  "cert": {
    "abc": {
      "us": {
        "usesExclusion": false,
        "included[0]": "1149043",
        "included[1]": "1127938",
        "included[2]": "13658",
        "included[3]": "107076"
      }
    }
  }
}

It's not parsing as an array it's just adding the key with an index number. This doesn't happen when the local application file is parsed, the reason for this is that you are using JS-YAML library for parsing local application.yml.

Expected:

  {
  "cert": {
    "abc": {
      "us": {
        "usesExclusion": false,
        "included": [
          "1149043",
          "1127938",
          "13658",
          "107076"
        ]
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions