Returning JSON data

Hello all,
I’m trying to return a specific portion of JSON data. When I deserialize the file and set up the necessary variables, I can return the policy id and the policy number with a write line command with the following statement
json_deserialized_test.GetValue(“PolicyId”).ToString

However I need to return the ActionType and it’s throwing an exception stating object reference not set to instance of an object. Here is the json data

{
“PolicyId”: xxxx,
“PolicyNumber”: “xxxxx”,
“CurrentAction”: {
“ActionSequence”: 1,
“ActionType”: “CANCEL”,
“Channel”: “New York”,

Hey @Eric13

Yes because that is inside CurrentAction array.

so if you will use
json_deserialized_test.GetValue(“CurrentAction”)

it will return that whole info like actionsequence,Action Type and so and so.

To get Particular Value of ActionType use below code.

json_data.SelectToken(“CurrentAction”).SelectToken(“ActionType”).ToString //use it with writeline to see .

Regards…!!
Aksh

Thanks Akshay! Problem solved

Eric Jones

Reporting Analyst Sr, USA

Business Productivity

9950 Mayland Drive, Richmond, VA 23233

Tel: 804 281 6771 ext 36771

Eric.Jones@allianz.com

cid:image001.png@01D1F180.BA7E6AD0