0

I have 2 screens on my front end 1 of which uses JSON to render itself and the other uses XML transformed by an XSLT to render a table. Both screens are tabs which the user can switch between quickly for reference purposes, therefore both pieces of data are required at the same time.

The two pieces of data are returned in the same COM interop call, as XML - 1 of which is parsed onto POCOs (and returned as Json) the other I want to return as straight XML. I don't want to have to call the COM interop method twice as it's a fairly beefy load. Ideally, I'd like to pass back the Json and the XML in the same controller method call to save me having to call the COM interop method again.

Is there any way I can return my XML and JsonResult from the same controller method?

Also, I currently use jQuery to make the call to the controller method, the data param contains the Json result, how would I be able to get a handle on the XML I would pass back as well?

1
  • I'm not too sure whether this is possible or not. Are there any reasons you can't return both as JSON or XML? Commented Nov 4, 2011 at 10:13

1 Answer 1

1

Can you not add a string property (poco.AsXML) to the POCO and set that as the xml? which gets passed back in the JSON object?

(if I have understood the question)

Sign up to request clarification or add additional context in comments.

1 Comment

That makes complete sense, can't believe I didn't think of that. Thanks very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.