Skip to content

Making a single element into an array #141

Answered by TomWright
link4531 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey again Link, I'm glad you're getting some use out of dasel!

The issue you're seeing here is because of this: https://daseldocs.tomwright.me/usage/supported-file-types#arrays-lists

More specifically:

Due to the way that XML is decoded, dasel can only detect something as a list if there are at least 2 items.

Dasel is reading your document as the following (in json form):

{
  "Server": {
    "Service": {
      "Connector": {
        "-port": "123"
      }
    }
  }
}

Basically, your breakdown is correct.

In many other data formats you would be expected to define the connectors as an array and this would then work entirely as expected, but since XML doesn't let you define something as an…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TomWright
Comment options

@link4531
Comment options

Answer selected by link4531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants