Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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

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
Csharp :: c# LCP 
Csharp :: unity random range 
Csharp :: make invisible unity 
Csharp :: unity look at target 
Csharp :: dotnet ef migrations to folder 
Csharp :: compile in one single exe c# 
Csharp :: WebClient c# with custom user agent 
Csharp :: c# parse the date in DD/MMM/YYYY format 
Csharp :: print array in c# 
Csharp :: open folder dialog c# 
Csharp :: how to change color of a sprite in unity 
Csharp :: c# compile code at runtime 
Csharp :: know to which direction Vector.MoveTowards is moving unity 2D 
Csharp :: c# wpf change label text color 
Csharp :: convert array object to int[] c# 
Csharp :: c# size of enum 
Csharp :: unity 2d movement 
Csharp :: get current playing animation of animator unity 
Csharp :: c# string array contains 
Csharp :: razor confirm password validation 
Csharp :: check if animation is playing unity 
Csharp :: dotnet build command 
Csharp :: .net c# print object 
Csharp :: get enum value from display name c# 
Csharp :: c# winforms textbox select text 
Csharp :: c# underscore variable 
Csharp :: httpwebrequest c# example 
Csharp :: editorfor date format mvc 
Csharp :: clamp vector3 unity 
Csharp :: binary search c# 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =