Add list to callback response

I’d like to return a list and/or dictionary along with a call of frappe.get_doc on my server-side code.
I get a validation error if try to setattr and add the list to the callback response.
When I try to put the list into a code or longtext docfield, it gives me an error, “… cannot be list type”.

Should I try to handle this with multiple callback? I would prefer to collect all the information in context and do it once, thought that may be a more construction.

I am open to recommendations, please let me know if there’s something I haven’t considered.

You can return a dict with the two objects like this:

return {
    "doc": frappe.get_doc(doctype, docname),
    "docs": frappe.get_list(doctype)

There’s not problem at all with this aproach.

Hey @yefritavarez - Thank you, that’s really clever and I got it working. The data structure I’m returning isn’t perfect, but I think I can make it work…