How to extract JSON object values?

Hi All,

Can someone please help me how I can extract value after comparing id of a custom field from JSON Response ?

Example below:

{
"ticket": {	
		"custom_fields": [
			{
				"id": 360012872960,
				"value": "Test 1"
			},
			{
				"id": 360005394179,
				"value": "Test 2"
			},
			{
				"id": 360011031300,
				"value": ""
			},
			{
				"id": 360015119620,
				"value": "Test 3"
			}
		]
}
}

Quick dirty Approach


myJObject("custom_fields").Values(Of JObject).Where(Function (x) x("id").toString().Equals("360005394179")).First()("value").toString

1 Like

use this example
aa.xaml (9.3 KB)
testjson.txt (240 Bytes)

i had to add an extra “]” at the end of the json for it to work
image

e.g. my targetID = 360011031300 then it will return the corresponding value

1 Like

A long / int64 based approach

myJObject("custom_fields").Values(Of JObject).Where(Function (x) x("id").Value(of Long) = 360011031300).Select(Function (x) x("value").toString).First()
1 Like

Thanks a lot @ppr :slight_smile:

Thank a lot @jack.chan :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.