Answers for "get json as object c#"

C#
6

c# get value from json object

using System;
using Newtonsoft.Json.Linq;

namespace testClient
{
    class Program
    {
        static void Main()
        {
            var myJsonString = "{report: {Id: \"aaakkj98898983\"}}";
            var jo = JObject.Parse(myJsonString);
            var id = jo["report"]["Id"].ToString();
            Console.WriteLine(id);
            Console.Read();
        }
    }
}
Posted by: Guest on June-11-2021
4

c# object to json string

Newtonsoft.Json.JsonConvert.SerializeObject(new {foo = "bar"})
Posted by: Guest on May-18-2020

C# Answers by Framework

Browse Popular Code Answers by Language