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 7998495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:13:31+00:00 2026-06-04T15:13:31+00:00

I am writing a console app that parses JSON data from an outside source.

  • 0

I am writing a console app that parses JSON data from an outside source. This is in C# using .NET 4.0 (the full version, not the client profile).
I am attempting to use the System.Web.Script.Serialization.JavaScriptSerializer class to deserialize JSON data into an object, like this:

var targetObject = deserializer.Deserialize<TargetObjectType>(json);

Normally this works fine, but when the data contains a very large collection, I get this error: System.InvalidOperationException (“Operation is not valid due to the current state of the object.”) I did some research and found this: http://support.microsoft.com/kb/2661403. Basically, Microsoft limits the number of items as a security precaution.

The way to override this is to add a record to Web.config as described in the support article, but in my case it doesn’t work. I did some research and found someone else with this problem here: http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx.

So my question is this: is there any way to use JavaScriptSerializer to deserialize a JSON object with a large collection in a console app?

PLEASE NOTE: My team lead would prefer to not use any library other than Microsoft’s. THIS MEANS I CANNOT USE JSON.NET (AKA NEWTONSOFT), SO PLEASE DO NOT SUGGEST IT.

  • 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-06-04T15:13:33+00:00Added an answer on June 4, 2026 at 3:13 pm

    I’d suggest you to opt for some other Json De/Serializer. For instance: http://james.newtonking.com/projects/json-net.aspx

    It pretty much handled anything I threw at it yet; even TB-sized dumps from Couchbase server (as long you have proper RAM in the machine that is going to de/serialize).

    /edit: I have read that you lead would prefer sticking to the vanilla Microsoft Webstack. However, referencing one more assembly is gonna save a ton of time and lot of headaches.

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

Sidebar

Related Questions

I am writing a console application that will do two tasks. The app will
I am writing a plain vanilla c++ console app using VS 2008. When I
I'm in the process of writing a simple console app that monitors a particular
I am writing an app that downloads a wav file from a server and
I'm currently writing a C# console app that generates a number of URLs that
I am writing a windows forms app that can launch a console for debugging.
Please help me with this one, I've been writing a console applicaiton using the
I am new to VS 3.5 and I am writing a console app that
I'm writing a console app in c++ using ncurses and I'd like to output
I'm writing a simple console app in C#, .NET 2.0. It starts new threads

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.