Click here to Skip to main content
14,836,532 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Json file that was deserialized from a Json Api-Call, now I have to use this file as an object in the main program.

Here is a small section of it:



How can I use this file as an object in the main program and work with it?

What I have tried:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Api1
{
    public class EcmSimpleField
    {
        public string value { get; set; }
        public string displayName { get; set; }
        public string internalName { get; set; }
        public string dbName { get; set; }
        public bool visible { get; set; }
        public string type { get; set; }
    }

    public class BaseParameter
    {
        public string value { get; set; }
        public string type { get; set; }
    }

    public class SystemField
    {
        public string value { get; set; }
        public string type { get; set; }
    }
Posted
Updated 18-Feb-21 21:33pm
v2
Comments
RickZeeland 18-Feb-21 7:42am
   
Your "small section of JSON" is missing

Here are some "great reads" on CodeProject: JSON[^]
   
I use this: Json.NET - Newtonsoft[^]
It's free, and pretty much one line of code to serialize or deserialize.

Combine that with a "JSON to C# classes" site like this: JSON Utils: Generate C#, VB.Net, SQL Table, Java and PHP from JSON[^]
And you're pretty much there.
   
Thank you for the answers
   
Comments
Richard Deeming 19-Feb-21 11:01am
   
If you want to reply to a solution, click the "Have a Question or Comment?" button under the solution and post a comment.

Do not post your comment as a new "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900