Skip to main content
March 22, 2022
Question

CLI V2 returns `-- fields` surrounded in double quotes, V1 didn’t

  • March 22, 2022
  • 11 replies
  • 1436 views

There is a pretty big breaking change in the CLI V2.
It now returns fields wrapped in double quotes.
Is this intended behavior? Any simple suggestion for getting it back to returning without those quotes?

Here’s a pretty minimally reproducible example:
echo '{ "title": ".env.local2", "category": "SECURE_NOTE", "fields": [ { "id": "notesPlain", "type": "STRING", "purpose": "NOTES", "label": "notesPlain", "value": "NEXT_PUBLIC_ENV=\"DEV\"" } ] }' > template.json

op item create --template template.json
ID: nfuwzcobqgc4gq764nqefk6g2q
Title: .env.local2
Created: now
Updated: now
Favorite: false
Version: 0
Category: SECURE_NOTE
Fields:
notesPlain: NEXT_PUBLIC_ENV="DEV"

op item get .env.local2 --fields notesPlain
"NEXT_PUBLIC_ENV=""DEV"""
op1 get item .env.local2 --fields notesPlain
NEXT_PUBLIC_ENV="DEV"


1Password Version: 2.0.0
Extension Version: Not Provided
OS Version: macOS 12.3

11 replies

June 13, 2022

@"Horia.Culea_1P" I'm using 1password to store a JSON document that I need to be able to simply export like it used to work in v1. Amongst all the great features there's no way of simply having a custom-filed object to simulate JSON – all of them are some kind of credential-bast schemas – none of what I want.

You have very fancy stuff like database, API credential, etc. but we can't create our own schema from a scratch, i.e., no password fields and such. As the result, the only way around this is to use a secure note. Which used to work just fine until it all got "improved".

Now I cannot just op item get "${OP_ITEM}" --fields label=notesPlain because apparently "it does the right thing". It doesn't to the right thing for me – that I am very certain of.

I cannot use op read op://path/to/item-field because my item has spaces and special characters and used in numerous docs and the rest of my 1password items follow a convention. I don't want to mess it up just to compensate for this "new and improved API".

And the best part I cannot use (or at least find how to use) 1password API to get the bloody item ID to use it with op read op://path/to/item-field where I cannot use special characters…

I've literally just spent over an hour trying to comprehend these v2 improvements and then double checked if there's an alternative to 1Password because this whole API shinanigans really gets to me for what it's worth.

*I want to be able to return the flipping item's value AS IT IS! *

Right now I need to use a completely different tool jq I've no idea who manages it and if it's actually secure or if it has dependencies. Did you even consider this?

If you want to be smart about this and add quotes, use another format for that, whether it's for CSV or anything else. What I'm getting now is neither human readable or valid or useful.

Thanks for wasting my morning on this. Massive thumbs down!