Vault.NET icon indicating copy to clipboard operation
Vault.NET copied to clipboard

Any way to fetch the raw json?

Open Karreg opened this issue 4 years ago • 0 comments

Hello,

I've been using your lib for 2 years for a keepass-vault plugin. And it has been working fine, until I met JSON structure in Vault that are not dictionaries, like:

{
  "key1" : {
    "subkey1": "subvalue1"
  },
  "key2" : {
    "subkey2": "subvalue"
  }
}

Or even lists:

{
  "data": [
    { struct 1 },
    { struct 2 }
  ]

So I tried to grab the raw JSON string, so I can manually parse it later, but I failed to do so.

I have tried with the ReadRaw method:

var bytes = Task.FromResult(client.Secret.ReadRaw(path).Result).Result;

But it fails with this exception:

Unexpected content media type application/json at Vault.VaultHttpClient.<HttpRequestRaw>d__15.MoveNext()

I have also tried with the Read method typed with string:

Task.FromResult(client.Secret.Read<string>(path).Result.Data).Result;

But it fails in JSON.NET since it only accept objects, not basic types.

Is there any way to get the raw json as a string?

Thanks!

Karreg avatar Mar 01 '21 10:03 Karreg