https://prefect.io logo
m

Moe

07/24/2023, 5:31 PM
Hi all, I'm trying to create a JSON block to store a username and password but I keep getting
value must be valid JSON
. Tried below, and also tried assigning it to a variable. Please advise.
Copy code
{'user': 'username',
 'pass': 'password'}
n

Nate

07/24/2023, 5:32 PM
hi @Moe - can you share the code you're using to create the block? it should be something like
Copy code
from prefect.blocks.system import JSON

my_block = JSON(value={"user": "username", "pass": "password"})
my_block.save("your-block-name", overwrite=True)
m

Moe

07/24/2023, 5:33 PM
I got that. But I'm trying to create it in my workspace UI under Blocks.
n

Nate

07/24/2023, 5:33 PM
gotcha, does the UI want double quotes?
m

Moe

07/24/2023, 5:34 PM
Indeed, that's the case 🙂
Thanks!
n

Nate

07/24/2023, 5:34 PM
👍
m

Moe

07/24/2023, 6:49 PM
I don't know about others but I am finding the web UI block quite buggy. At least for JSON.
In terms of cursor placement and hitting enter at a cursor messing things up.
n

Nate

07/24/2023, 6:50 PM
fields that are expected to be valid JSON should be generally treated the same across all block types if you find some weird behaviour, itd be incredibly helpful if you could open an issue (tagged
ui
) with a screen recording showing how its messing up
1
2 Views