Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

c# json get value by key

string jsonData = @"{
'FirstName':'Pietie',
'LastName':'Massimo'
}";

var details = JObject.Parse(jsonData);
var firstName = details["FirstName"]

or 

dynamic details = JObject.Parse(jsonData);
var firstName = details.FirstName;
Comment

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();
        }
    }
}   
Comment

how to get key value from json object in c#

//You want to convert it to an object first and then 
//access normally making sure to cast it.

JObject obj = JObject.Parse(json);
string name = (string) obj["Name"];
Comment

PREVIOUS NEXT
Code Example
Javascript :: localsstorage array append element 
Javascript :: how to get the year in javascript 
Javascript :: how to check if selector exists or is present puppeteer 
Javascript :: set select option as selected jquery 
Javascript :: javascript float to int 
Javascript :: check comma in string javascript 
Javascript :: jquery datepicker no past dates 
Javascript :: javascript array includes another array 
Javascript :: javascript replace spaces with nbsp 
Javascript :: js set class 
Javascript :: regex javascript password 
Javascript :: get browser language 
Javascript :: js explode equivalent 
Javascript :: how to remove the parent div from the child in jquery 
Javascript :: javascript median of array 
Javascript :: send a file ajax 
Javascript :: get height and width of screen in react native 
Javascript :: clone object in js 
Javascript :: javascript convert seconds to minutes seconds 
Javascript :: cypress clear session storage 
Javascript :: iseven js 
Javascript :: nodejs get file size 
Javascript :: window viewport size javascript 
Javascript :: Unknown command: "create-react-app" 
Javascript :: uuid generator pure javascript 
Javascript :: get last three characters of string javascript 
Javascript :: object key value as string ts type js 
Javascript :: socketio cdn 
Javascript :: get localstorage 
Javascript :: console log add new line 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =