Skip to content

props to yaml conversion does not handle lists propery #2691

@ruudbleeker

Description

@ruudbleeker

Describe the bug
When converting Java application properties to yaml, lists are not handles properly.

Version of yq: 4.52.4
Operating system: linux
Installed via: binary release

Input Properties

input.properties:

user.credentials[0].username=user1
user.credentials[0].password=$2b$08$...
user.credentials[1].username=user2
user.credentials[1].password=$2b$08$...
user.credentials[2].username=user3
user.credentials[2].password=$2b$10$...

Command
The command you ran:

yq --input-format props --output-format yaml --properties-array-brackets application.properties > application.yaml

Actual behaviour

faulty_output.yaml:

user:
  credentials[0]:
    username: user1
    password: $2b$08$...
  credentials[1]:
    username: user2
    password: $2b$08$...
  credentials[2]:
    username: user3
    password: $2b$10$...

Expected behaviour

correct_output.yaml

user:
  credentials:
    - username: user1
      password: $2b$08$...
    - username: user2
      password: $2b$08$...
    - username: user3
      password: $2b$10$...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions