spring-cloud-config icon indicating copy to clipboard operation
spring-cloud-config copied to clipboard

Unable to parse YAML array from Cloud config

Open 4sujittiwari opened this issue 4 years ago • 0 comments

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"
        ]
      }
    }
  }
}

4sujittiwari avatar Jan 06 '21 12:01 4sujittiwari