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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:31:48+00:00 2026-05-10T21:31:48+00:00

WinForms C#.. am getting some JSON in the format below (bottom of message) and

  • 0

WinForms C#.. am getting some JSON in the format below (bottom of message) and trying to deserialise using:

using System.Web.Script.Serialization;

When I had simply this json returned:

{ 'objects': [     {         'categoryid': '1',         'name': 'funny',         'serverimageid': '1',         'dateuploaded': '2008-11-17 16:16:41',         'enabled': '1'     },     {         'categoryid': '2',         'name': 'happy',         'serverimageid': '2',         'dateuploaded': '2008-11-17 16:17:00',         'enabled': '1'     },     {         'categoryid': '3',         'name': 'sad',         'serverimageid': '3',         'dateuploaded': '2008-11-16 16:17:13',         'enabled': '1'     } ] } 

Then is was easy to deserialize: (yikes.. a bit hacky)

// s is the string s = s.Remove(0, 11); // last } int stringLength = s.Length; s = s.Remove(stringLength - 1, 1);  listOfCategories = serializer1.Deserialize<List<Category>>(s); 

Where

public class Category     {         public int categoryID;         public string name;         public int imageID;         public DateTime dateUpdated;         public int isActive;         public int displayOrder;     } 

However now, I’m stuck! Have tried a list of lists… but can’t get anywhere..

Much appreciated any help.

{     'objects': {         'categories': [             {                 'name': 'Congratulations',                 'imageID': '1',                 'isActive': '1',                 'displayOrder': '0',                 'dateUpdated': '2008-11-27 00:00:00'             },             {                 'name': 'Animals',                 'imageID': '2',                 'isActive': '1',                 'displayOrder': '0',                 'dateUpdated': '2008-11-26 00:00:00'             },             {                 'name': 'Romance',                 'imageID': '3',                 'isActive': '1',                 'displayOrder': '0',                 'dateUpdated': '2008-11-24 00:00:00'             }         ],         'present': [             {                 'presentID': '1',                 'name': 'Tiger',                 'categoryID': '2',                 'imageID': '1',                 'dateUpdated': '2008-11-27',                 'isActive': '1',                 'isAnimated': null,                 'isInteractive': null,                 'isAdaptive': null,                 'webLinkURL': null             },             {                 'giphtID': '2',                 'name': 'Donkey',                 'categoryID': '2',                 'imageID': '2',                 'dateUpdated': '2008-11-27',                 'isActive': '1',                 'isAnimated': null,                 'isInteractive': null,                 'isAdaptive': null,                 'webLinkURL': null             },             {                 'giphtID': '3',                 'name': 'Elephant',                 'categoryID': '2',                 'imageID': '3',                 'dateUpdated': '2008-11-27',                 'isActive': '1',                 'isAnimated': null,                 'isInteractive': null,                 'isAdaptive': null,                 'webLinkURL': null             }         ]     } } 
  • 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. 2026-05-10T21:31:49+00:00Added an answer on May 10, 2026 at 9:31 pm

    This seems to work fine (And no wacky string trimming!):

    using System; using System.Collections.Generic; using System.Web.Script.Serialization;  class Program {     static void Main( string[] args )     {         string json = System.IO.File.ReadAllText( '../../input.json' );          var serializer = new JavaScriptSerializer();         Structure jsonStructure = serializer.Deserialize<Structure>( json );         System.Diagnostics.Debugger.Break();     } }  class Structure {     public StructureObjects objects; }  class StructureObjects {     public List<StructureCategory> categories;     public List<StructurePresent> present; }  class StructureCategory {     public string name;     public int imageID;     public DateTime dateUpdated;     public int isActive;     public int displayOrder; }  class StructurePresent {     public int presentID;     public string name;     public int categoryID;     public int imageID;     public DateTime dateUpdated;     public int isActive;     public int? isAnimated;     public int? isInteractive;     public int? isAdaptive;     public Uri webLinkURL; } 

    Thanks for the System.Web.Script.Serialization pointer, I would never have found that!

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Sounds like a valid usage scenario to me.. just realise… May 11, 2026 at 12:18 pm
  • added an answer Without knowing too much about your setup, I'd say it's… May 11, 2026 at 12:18 pm
  • added an answer There are several very mature javascript implementations that are server-framework… May 11, 2026 at 12:18 pm

Related Questions

So i am reorganizing a winforms C# solution to help decouple and make it
(Using WinForms and C#. -> .Net 2.0) I am adding nodes to a TreeView
this isn't asp.net specific, some of these apps are WinForms, also will be adding
What happens to the name/value pairs stored inside a form's resx file? Are they

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.