Skip to content

cgen error: json: can not decode x.json2.Any sumtype #23769

Discussion options

You must be logged in to vote

a temporary solution
for veb.Context.json()

now case

pub fn (app &App) index(mut ctx Context) veb.Result {
	d := json2.raw_decode('{"name": "Bob"}') or { -1 }
	
	return ctx.json(d) // err  // json: can not decode `x.json2.Any`
}

temporary solution

pub fn (app &App) index(mut ctx Context) veb.Result {
	d := json2.raw_decode('{"name": "Bob"}') or { -1 }
	
	json_s := json2.encode(d)
	return ctx.send_response_to_client('application/json', json_s)
}

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by vodish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant