Is it possible to pass a Json Object as value on a checkbox I have multiple checkboxes like below... selectedUsers is an array that contains the selected values... id like to end up with a json array like [{"userid": "12345"}, {"userid": "54321"}]
<input
:id="`checkbox` + index" v-model="selectedUsers"
:value="{"userId": user.userId}"
@change="selectUsers"
The above gives me a parsing error Parsing error: unexpected-character-in-attribute-name.
I am able to pass an object like this
:value="{userId: user.userId}"
Is there a clever way to achieve what i want here?
{"userId": user.userId}as a string?:value="{"userId": user.userId}"is interpreted as:value="{"anduserId": user.userId}", the second of which is invalid. Use different quotation marks instead: `:value="{'userId': user.userId}"'userIdin quotes at all, which is what you did on the second one.... so, what exactly are you wanting to do? In what way precisely is:value="{userId: user.userId}"not doing what you want?