json - Returning ViewBag as JSONResult result in null data?? wtf? -



json - Returning ViewBag as JSONResult result in null data?? wtf? -

what missing? trying following:

public jsonresult loggedon() { viewbag.firstname = "todd"; viewbag.lastname = "billings" viewbag.email = "me@rad.com"; homecoming json(viewbag, jsonrequestbehavior.allowget); }

the result in js making phone call null/empty? there no built in conversion of viewbag json result? missing? if other object converts json.

viewbag expandoobject such there's nil json converter reflect against. best bet here create anonymous object rather rely on viewbag

here's illustration found on stackoverflow: can serialize expandoobject in .net 4?

json asp.net-mvc-3

Comments

Popular posts from this blog

ios - Fragment Shader GLSL for texture, color and texture/color -

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -