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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:25:06+00:00 2026-06-06T14:25:06+00:00

I am using the Javascript serializer to parse a JSON file. Its runs fine

  • 0

I am using the Javascript serializer to parse a JSON file. Its runs fine when the file is in a valid json format but failing for instance there is a extra comma in the last field. How could I bypass that, I am only retrieving the replicateid from this file:

{
    "Orders": 
    [
       {
            "Rack": "0014",
            "SampleType": "Calibrator",
            "Replicate": 3,
            "Track": 1,
            "Lane": 2,
            "ReagentMasterLot": "06100AA02",
            "ReagentSerialNumber": "60002",
            "Comment": "HTLV Cal T1L2",
        }
   ]      
}

public static KeyValuePair<bool, int> CyclesCompleted(string fileName)
{
    int cyclesCompleted = 0;
    JavaScriptSerializer ser = jss();
    bool isValid = true;
    try
    {
        CategoryTypeColl ctl = ser.Deserialize<CategoryTypeColl>(LoadTextFromFile(fileName));

        if (ctl != null)
        {
            List<CategoryType> collection = (from item in ctl.orders
                                             select item).ToList();

            foreach (var replicates in collection)
            {
                cyclesCompleted = cyclesCompleted + replicates.Replicate;
            }
        }
    }
    catch
    {
        isValid = false;
    }
    return new KeyValuePair<bool, int>(isValid, cyclesCompleted);
}
  • 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-06T14:25:08+00:00Added an answer on June 6, 2026 at 2:25 pm

    You should use JSON.NET. it is an open source library to serialize and deserialize the .net objects to json string and vice versa. It almost solve these kind of issues which .net json serializiation not.

    string json = @"{
      ""Name"": ""Apple"",
      ""Expiry"": new Date(1230422400000),
      ""Price"": 3.99,
      ""Sizes"": [
        ""Small"",
        ""Medium"",
        ""Large""
      ]
    }";
    
    JObject o = JObject.Parse(json);
    
    string name = (string)o["Name"];
    // Apple
    
    JArray sizes = (JArray)o["Sizes"];
    
    string smallest = (string)sizes[0];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using XStream and JETTISON's Stax JSON serializer to send/receive messages to/from JSON javascripts
I am trying to parse Open Exchange Rates JSON in Json, and I'm using
I am using ASP.Net to serialize classes designed in C# to JSON. My Javascript
I'm using the JSON framework in Obj-C (iOS) to parse responses from a RESTful
I am using XMLHttpRequest to send a file from javascript code to a django
Using javascript, How can I convert a human time string like Wed Jun 20
Using JavaScript, is it possible to use prototype to add a method to a
Using JavaScript I'm trying to split a paragraph into it's sentences using regular expressions.
Using JavaScript I open the pop window and parent window is inactive at this
using Javascript, it is easy to programatically select the text inside a textarea or

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.