Skip to content

Problem with list convertions #22

@stg-

Description

@stg-

Hi there!

I'm facing a problem trying to import/export some data into etcd using etcdtool. Since lists are converted into json objects creating directories using the index as the key, when I load a json file with a list and then try to export the destination key, both json files differ.

Example:

# cat test.json 
{
  "mylist": [
    { "one": "uno"},
    {"two": "dos"}
  ]
}
# ./etcdtool-3.4 --peers="https://myetcd:2379" import -y /test ./test.json
# ./etcdtool-3.4 --peers="https://myetcd:2379" export /test
{
  "mylist": {
    "0": {
      "one": "uno"
    },
    "1": {
      "two": "dos"
    }
  }
}

It would be great to export the directory so the resulting json file is the same that was loaded (expected behavior: when all the keys in a directory are whole numbers, then convert them into a list). Maybe it can be added as an optional parameter (e.g. --keep-lists)?.

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