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

Related Questions

I'm just getting dirty in WinForms, and I've discovered, through a lovely tutorial, the
Does anyone know what this means. Getting this in C# winforms applications: Not a
My WinForms application has a tab with a System.Windows.Forms.WebBrowser control. There are several controls
I'm using C# for WinForms app in VS2010 and I needed to create a
In WinForms, I can design a form and have a TabValue to control which
Our WinForms application has been reported to occasionally just close on its own. It
My WinForms app uses a number of BackgroundWorker objects to retrieve information from a
With WinForms, I can use Control.Scale to scale a control larger. When I do
The WinForms TextBox has an 'Undo' command but has not a 'Redo' command -
In Winforms you can say if ( DesignMode ) { // Do something that

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.