Hi I am trying to load a Json
response to Sql Server
. But the Json
can be a string
or an object
causing.
Here is an example when it is a string
:
{
"result": [
{
"upon_approval": "proceed",
"location": {
"link": "https://satellite.service-now.com/api/now/table/cmn_location/4a2cf91b13f2de00322dd4a76144b090",
"value": "4a2cf91b13f2de00322dd4a76144b090"
}}]}
Here is an example of when it is an object
{
"result": [
{
"upon_approval": "proceed",
"location": ""}]}
And my C# class is like
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace incident
{
public class Location
{
public string link { get; set; }
public string value { get; set; }
}
public class Result
{
public Location location { get; set; }
}
public class RootObject
{
public List<Result> result { get; set; }
}
}
I am using Newtonsoft.Json
. Is there an easy way to do this?