2

I am new to Consul.

I am trying to import a key/value pair from Json File. (working in windows env)

But when I try to import with the following command, facing error.

Command:

consul.exe kv import @keyvalue.json

Contents:

{"MYVAR": "123","AnotherKey":"SomeValueHere"}

Error:

Cannot unmarshal data: json: cannot unmarshal object into Go value of type []*command.kvExportEntry

Could any one suggest some ideas, in solving this error.

Thanks.

Azeem
  • 11,148
  • 4
  • 27
  • 40
NANDAKUMAR THANGAVELU
  • 611
  • 3
  • 15
  • 34

1 Answers1

4

Ah,

Got it.

We have throw the json in this following format.

[        {
                "key": "europe",
                "flags": 0,
                "value": "NzQzLjE="
        },
        {
                "key": "europe/france",
                "flags": 0,
                "value": "NjYuOQ=="
        },
        {
                "key": "europe/germany",
                "flags": 0,
                "value": "ODIuNjc="
        }
]

Reference from: http://alesnosek.com/blog/2017/07/15/first-look-at-the-key-value-store-in-consul/

Thx.

NANDAKUMAR THANGAVELU
  • 611
  • 3
  • 15
  • 34