Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 273297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:26:10+00:00 2026-05-12T00:26:10+00:00

Currently I am using the terrific Linq 2 Json.net (by newtonsoft), which is a

  • 0

Currently I am using the terrific Linq 2 Json.net (by newtonsoft), which is a very great simple tool to generate JSON result in programatic way.

But after finishing some projects, I stopped and rethink, should I generate the JSON result in the controller? I mean, in .net MVC framework, it DOES provided a JSONResult as one of the ViewResult. But should the controller bother how the result is generated? Or should it just “Provide” the data to view, and it should be the view’s job to generate the necessary output (and formatting)?

One last thing, I also heard that using “ViewData” in controller might not be a good idea as controller is concerning too much on display/output issue, any better pattern or method could be use?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:26:11+00:00Added an answer on May 12, 2026 at 12:26 am

    I think I will justify the JSON output in Controller as JSON is just a form of ViewData, just similar thing as using ViewData Dictionary to communicate with the View pages.

    And the actual View page is already rendered, or handled by the client side languages. Although one downside is, the JSON-output Controller is quite dependent to the view, yes, you can still change the view to some other thing which accepts that JSON as channel of communication, but not a good idea if you want to change the client to, for example, a desktop application using other channels as communication (like, direct TCP connection nor SOAP application etc.) coz the controller is made for JSON. (true you can make an adapter to do translation).

    So to wrap it up, JSON rendering in controller is OK as long as you are not planning to other platform while presisting the controller unchanged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently using Telerik ASP .NET MVC Controls version 2011.2.712 Hello all, I am trying
Note: Currently using Perforce as a CM tool. I currently do several debug releases
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a
Im currently using Apache behind an Nginx Proxy which really works fine with one
Im currently using a simple javascript redirect (called on load) with a delay to
I'm currently using VS2005 Profesional and .NET 2.0, and since our project is rather
I'm currently using json and http to call perl functions from python, but it's
I am currently using the following code but its very slow for large numbers
Currently using the HTTPServletRequest class and specifically the .getQueryString method to retrieve an inputted
Currently using Google Analytics as a supplement to our paid tracking software, but neither

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.