Hi all, I'm trying to create a JSON block to store...
# ask-community
m
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
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
I got that. But I'm trying to create it in my workspace UI under Blocks.
n
gotcha, does the UI want double quotes?
m
Indeed, that's the case 🙂
Thanks!
n
👍
m
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
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