Extracting value from json string C# - c#

My json string is as follows:
{
"data": {
"order_reference": "7000016543",
"package_data": [
{
"tracking_no": "34144582723408",
"package_reference": "7000016543"
}
]
},
"success": true
}
How do I get tracking_no from this json.
I tried using
dynamic jsonObj = JsonConvert.DeserializeObject(bytesAsString);
and then
foreach (var obj in jsonObj.items)
{
}
but it only yields order reference.

You can create Types for your JSON:
namespace Example
{
using System;
using System.Net;
using System.Collections.Generic;
using Newtonsoft.Json;
public class MyObject
{
[JsonProperty("data")]
public Data Data { get; set; }
[JsonProperty("success")]
public bool Success { get; set; }
}
public class Data
{
[JsonProperty("order_reference")]
public string OrderReference { get; set; }
[JsonProperty("package_data")]
public PackageDatum[] PackageData { get; set; }
}
public class PackageDatum
{
[JsonProperty("package_reference")]
public string PackageReference { get; set; }
[JsonProperty("tracking_no")]
public string TrackingNo { get; set; }
}
}
then you can deserialize using JsonConvert.Deserialize<MyObject>(input);

the problem about your code is: there is no collection on your root json object. I mean it is not an object. Since it is just an object and it's child you can access is directly. And then you have a collection package_data. So you can go for loop in it.
Here is the schema of your json data.
foreach(dynamic item in jsonObj.item.package_data)
{
//item.tracking_no;
//item.package_reference
}

Related

Convert Json to C# class using IEnumerable<>

I have a Json which looks like this...
{
"steps": [
{
"stepsType": "runWizard",
"wizardType": "cv2.0Server",
"config": {
"mode": "add",
"resourceName": "cv2.0 Server",
"activeDbPrimaryServer": {
"serverName": "JJH3M005A",
"serverAddress": "JJH3M005A.microsoft.info"
},
"activeDbCatalog": "cv2.0Database",
"activeDBUserId": "user",
"activeDBPassword": "password",
"activeIntegratedSecurity": false
}
}
]
}
I have created a model like this...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.Database.Configuration.Model
{
public class ClusterConfigurationModel
{
public IEnumerable<ClusterConfigurationModelStep> Steps { get; }
}
public class ClusterConfigurationModelStep : ClusterConfigurationModel
{
public string StepType { get; }
public string WizardType { get; }
public IEnumerable<ClusterConfigurationServerConfig> Config { get; }
}
public class ClusterConfigurationServerConfig : ClusterConfigurationModelStep
{
public string Mode { get; }
public string ResourceName { get; }
public IEnumerable<ClusterConfigurationDbPrimaryServer> ActiveDbPrimaryServer { get; }
public string ActiveDbCatalog { get; }
public string ActiveDbUserId { get; }
public string ActiveDbPassword { get; }
public string ActiveIntegratedSecurity { get; }
}
public class ClusterConfigurationDbPrimaryServer : ClusterConfigurationServerConfig
{
public string ServerName { get; }
public string ServerAddress { get; }
}
}
Is this correct I am trying to create a custom json convertor using,
AbstractJsonConverter
JsonConverterFactory with an Interface
JsonConverter with an Interface
I am new to C#, just want to know whether the model I have created is correct or do I need some modification?
First of all, you need not to have inheritance for every single class. For example (after removing inheritance):
public class ClusterConfigurationModelStep : ClusterConfigurationModel
{
public string StepType { get; }
public string WizardType { get; }
public IEnumerable<ClusterConfigurationServerConfig> Config { get; }
}
Second, you may want to have [JsonProperty("json_key_name")] from Newtonsoft.Json or [JsonPropertyName("json_key_name")] from System.Text.Json for mapping JSON keyfield name to class's variable. It is by default using camelCase in C#.
You should avoid using IEnumerable<T> for fields and properties, use a T[] array or an IList<T> instead.
The reason for this is that an enumerable is an interator that contains state, it contains a reference to the current item being pointed to. This means that it can only be consumed once, and then you can not enumerate the contents again.
Instead, you usually want to create a list instead and then enumerate that list multiple times in multiple places in your code.

Getting empty(blank) value while printing JSON field (value) using JsonConverter.Deserialize in C#

I am trying to parse a JSON using NewtonSoft (my JSON is an array type). Below is what it looks like...
{
"steps": [
{
"stepsType": "runWizard",
"wizardType": "demoServer",
"config": {
"mode": "add",
"resourceName": "demo server 1",
"activeDbPrimaryServer": {
"serverName": "abc",
"serverAddress": "abc.demo.local"
},
"activeDbCatalog": "demoActiveDB",
"activeDBUserId": "sa",
"activeDBPassword": "xyz",
}
}
]
}
I have created a class using JsonToC# convertor....
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ServerSetupWizardConsoleApp
{
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class ActiveDbPrimaryServer
{
public string serverName { get; set; }
public string serverAddress { get; set; }
}
public class Config
{
public string mode { get; set; }
public string resourceName { get; set; }
public ActiveDbPrimaryServer activeDbPrimaryServer { get; set; }
public string activeDbCatalog { get; set; }
public string activeDBUserId { get; set; }
public string activeDBPassword { get; set; }
}
public class Step
{
public string stepsType { get; set; }
public string wizardType { get; set; }
public Config config { get; set; }
}
public class Root
{
public List<Step> steps { get; set; }
}
}
And now when I am trying to deserialise it in another class, I am getting a empty response in console...
I have a TEXT from where I am reading the JSON and then storing it in a string type variable and the using the string to deserialise it.
public Object ReadJson()
{
string jsonText = File.ReadAllText("C:\\Desktop\\demo.json");
var rootObject = (Root) JsonConvert.DeserializeObject(jsonText, typeof(Root));
var activeDbAttr = (ActiveDbPrimaryServer)JsonConvert.DeserializeObject(jsonText, typeof(ActiveDbPrimaryServer));
Console.WriteLine("Value : " + activeDbAttr.serverAddress);
}
This activeDbAttr.serverAddress is giving me nothing in CONSOLE
It print --> value : (nothing after ":" like blank)
Can someone tell me what is wrong here. I followed some old answers, not getting to a point where I can fix it.
Live demo : https://dotnetfiddle.net/PuO8F8
It's a simple navigation issue.
You deserialize to a Root object, and instead of navigating with the property you deserialize again into an other thing, hopping to land in the right place.
var rootObject = JsonConvert.DeserializeObject<Root>(jsonText);
var activesDBs = json.steps.Select( x=> x.config.activeDbPrimaryServer).ToList();
Result:
Dumping object(System.Linq.SelectListIterator`2[Step,ActiveDbPrimaryServer])
[
{
serverAddress : abc.demo.local
serverName : abc
}
]
Why did it failed ?
var jsonDB = JsonConvert.DeserializeObject<ActiveDbPrimaryServer>(GetJson());
Tell the Parser that the Json is of type ActiveDbPrimaryServer.
The parser open the Json and find the first object:
{
"steps": [..]
}
Look for the property of the expected type ActiveDbPrimaryServer
public class ActiveDbPrimaryServer
{
public string serverName { get; set; }
public string serverAddress { get; set; }
}
And find nothing. It end there and give you an object of the right type with no property initialized
Partial deserialization:
If you want to deserialize only the part you need, refer to this documentation from Newtonsoft:
Deserializing Partial JSON Fragments
JObject rootObj = JObject.Parse(GetJson());
// get JSON result objects into a list
IList<JToken> results = rootObj["steps"].Children() // Step is a list so we use `.Children()`
["config"]["activeDbPrimaryServer"].ToList();
IList<ActiveDbPrimaryServer> dbResults = new List<ActiveDbPrimaryServer>();
foreach (JToken result in results)
{
// JToken.ToObject is a helper method that uses JsonSerializer internally
ActiveDbPrimaryServer dbResult = result.ToObject<ActiveDbPrimaryServer>();
dbResults.Add(dbResult);
}
you are deserializing
var rootObject = (Root) JsonConvert.DeserializeObject(jsonText, typeof(Root));
var activeDbAttr = (ActiveDbPrimaryServer)JsonConvert.DeserializeObject(jsonText, typeof(ActiveDbPrimaryServer));
[the second one yields null ... and null cast to ActiveDbPrimaryServer yields null.]
the same string twice into 2 different types of objects that do not share common base class (of course other than object).
your text represents either a Root or a ActiveDbPrimaryServer not both. the ActiveDbPrimaryServer is a member of the config class and that in turn of Step. ....
step through your graph root.Step.Config .. if all the instances are set you should reach your instance of ActibeDdPrimaryServer

JSON Serialization in C# SSIS

RESOLVED: I stopped treating the string like an array and instead added a line-feed delimiter to the connection manager, so that each row was treated like a new line. This has resolved the issue and eliminated the need to handle this via a C# script.
I've built an SSIS package that uses a C# script task to deserialize JSON strings and insert them into a table.
I've got this working with a prototype JSON string:
{"name":"Test 1","code":"398057008","table":"SNOMEDCT","addedby":"morgan.baxter","dateadded":1544523489235,"qualifier":[{"name":"Qualifier","value":"Confirmed Diagnosis","code":"410605003","prefix":"[C] "}],"prefix":"[C] "}
But when I try to add a second item to the JSON string I receive an error:
[{"name":"Test 2","code":"398057008","table":"SNOMEDCT","addedby":"morgan.baxter","dateadded":1544523489235,"qualifier":[{"name":"Qualifier","value":"Confirmed Diagnosis","code":"410605003","prefix":"[C] "}],"prefix":"[C] "},{"name":"Test 2","code":"44255352","table":"SNOMEDCT","addedby":"morgan.baxter","dateadded":1544523489235,"qualifier":[{"name":"Qualifier","value":"Confirmed Diagnosis","code":"53252355","prefix":"[C] "}],"prefix":"[C] "}]
Error:
Type 'SC_8aae662509ae4bab8491323924579173.Diagnosis' is not supported
for deserialization of an array.
From what I can understand, this is simply saying that my 'Parser' essentially cannot support an array of JSON fields in a string.
Here is my main code block:
#region Namespaces
using System;
using System.Data;
using System.Collections.Generic;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
using System.Web.Script.Serialization;
using Microsoft.SqlServer.Dts.Pipeline;
namespace SC_8aae662509ae4bab8491323924579173
#endregion
{
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public class ScriptMain : UserComponent
{
///<param name="Row">The row that is currently passing through the component</param>;
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
JavaScriptSerializer js = new JavaScriptSerializer();
// Give the input column a variable to make it easier to reference.
BlobColumn combinedColumn = Row.Column0;
// Convert from blob to string
string reviewConverted = System.Text.Encoding.ASCII.GetString(combinedColumn.GetBlobData(0, Convert.ToInt32(combinedColumn.Length)));
Diagnosis diagnosis = new Diagnosis();
// Deserialize the string
diagnosis = js.Deserialize<Diagnosis>(reviewConverted);
// Assign values to output columns
Row.name = diagnosis.name;
Row.code = diagnosis.code;
Row.table = diagnosis.table;
Row.addedby = diagnosis.addedby;
Row.dateadded = diagnosis.dateadded;
Row.qualifierName = diagnosis.Qualifier[0].name;
Row.qualifierValue = diagnosis.Qualifier[0].value;
Row.qualifierCode = diagnosis.Qualifier[0].code;
Row.qualifierPrefix = diagnosis.Qualifier[0].prefix;
if (diagnosis.Qualifier.Length == 2)
{
Row.lrName = diagnosis.Qualifier[1].name;
Row.lrValue = diagnosis.Qualifier[1].value;
Row.lrCode = diagnosis.Qualifier[1].code;
Row.lrSuffix = diagnosis.Qualifier[1].prefix;
}
Row.jsonString = reviewConverted;
Row.prefix = diagnosis.prefix;
Row.suffix = diagnosis.suffix;
}
}
}
Qualifier class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SC_8aae662509ae4bab8491323924579173
{
class qualifier
{
public string name { get; set; }
public string value { get; set; }
public string code { get; set; }
public string prefix { get; set; }
}
}
Diagnosis class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SC_8aae662509ae4bab8491323924579173
{
class Diagnosis
{
public string name { get; set; }
public string code { get; set; }
public string table { get; set; }
public string addedby { get; set; }
public string dateadded { get; set; }
public qualifier[] Qualifier { get; set; }
public string prefix { get; set; }
public string suffix { get; set; }
public string jsonString { get; set; }
}
}
I've tried to cater for more than one diagnosis with an array and my if function, but to no avail. Any ideas? Many thanks.
You say, that you pass array instead of an object in json. So why do you keep trying to deserialize into Diagnosis object?
You should really use Collection with your type Diagnosis here:
// Deserialize the string
var diagnosisCollection = js.Deserialize<ICollection<Diagnosis>>(reviewConverted);
instead of old
// Deserialize the string
diagnosis = js.Deserialize<Diagnosis>(reviewConverted);
And then assign values for you output columns, using foreach
foreach (var diagnosis in diagnosisCollection ) {
// do stuff with your buffer here
}
SSIS script can be a wierd environment. And you're right to avoid using a 3rd party JSON parser here. But somewhere you've got the type definitions messed up.
I often find it useful to write, test and troubleshoot code in a console app before integrating it into an SSIS script component/task. EG
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp14
{
class Program
{
class qualifier
{
public string name { get; set; }
public string value { get; set; }
public string code { get; set; }
public string prefix { get; set; }
}
class Diagnosis
{
public string name { get; set; }
public string code { get; set; }
public string table { get; set; }
public string addedby { get; set; }
public string dateadded { get; set; }
public qualifier[] Qualifier { get; set; }
public string prefix { get; set; }
public string suffix { get; set; }
public string jsonString { get; set; }
}
static void Main(string[] args)
{
var json = #"
[
{
""name"": ""Test 2"",
""code"": ""398057008"",
""table"": ""SNOMEDCT"",
""addedby"": ""morgan.baxter"",
""dateadded"": 1544523489235,
""qualifier"": [
{
""name"": ""Qualifier"",
""value"": ""Confirmed Diagnosis"",
""code"": ""410605003"",
""prefix"": ""[C] ""
}
],
""prefix"": ""[C] ""
},
{
""name"": ""Test 2"",
""code"": ""44255352"",
""table"": ""SNOMEDCT"",
""addedby"": ""morgan.baxter"",
""dateadded"": 1544523489235,
""qualifier"": [
{
""name"": ""Qualifier"",
""value"": ""Confirmed Diagnosis"",
""code"": ""53252355"",
""prefix"": ""[C] ""
}
],
""prefix"": ""[C] ""
}
]
";
System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
// Deserialize the string
var diagnoses = js.Deserialize<Diagnosis[]>(json);
Console.WriteLine("Complete");
Console.ReadKey();
}
}
}

Azure Service-Fabric and DocumentDB message serialization issue

So, - in my DocumentDB I may have the following document:
{
"id": 1,
"type": "A",
"content": {
"x": 1,
"y": 2
}
}
That may be backed by this model:
public class acontent
{
public int x { get; set; }
public int y { get; set; }
}
public class document
{
public int id { get; set; }
public string type { get; set; }
public object content { get; set; }
}
public class documenta : document
{
public new acontent content { get; set; }
}
The idea here is that document is a complex object where content may vary depending on type.
Now, - in my ServiceFabric application I have a stateless microservice that reads from DocumentDB and should return a document type object when called from the ServiceProxy.
The problem in this is that the DocumentQuery from the DocumentDB SDK, uses Json.NET serializer when querying the database, whilst servicefabric uses DataContractSerializer for serializing the service-messages.
So when the content part of document class is being deserialized from the DocumentDB it becomes:
Newtonsoft.Json.Linq.JObject
But when it is serialized back through the returned service-message you get the exception:
Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data
contract which is not supported. Consider modifying the definition of
collection 'Newtonsoft.Json.Linq.JToken' to remove references to
itself.
To illustrate this issue try the folowing code:
using System;
using System.IO;
using System.Text;
using System.Runtime.Serialization.Json;
using Newtonsoft.Json;
namespace jsoinissue
{
public class acontent
{
public int x { get; set; }
public int y { get; set; }
}
public class document
{
public int id { get; set; }
public string type { get; set; }
public object content { get; set; }
}
public class documenta : document
{
public new acontent content { get; set; }
}
public class Program
{
private const string JSON_A = "{\"id\":1,\"type\":\"A\",\"content\":{\"x\":1,\"y\":2}}";
private static string SerializeObject<T> (T obj)
{
try
{
DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(T));
using (var ms = new MemoryStream())
{
js.WriteObject(ms, obj);
ms.Position = 0;
using (var sr = new StreamReader(ms))
return sr.ReadToEnd();
}
}
catch (Exception e)
{
return String.Format("EXCEPTION: {0}",e.Message);
}
}
public static void Main()
{
var A = JsonConvert.DeserializeObject<document>(JSON_A);
var a = SerializeObject<document>(A);//HERE BE TROUBLE
Console.WriteLine(a);
Console.ReadKey();
}
}
}
How could I best resolve this issue?
Your basic problem is that DataContractJsonSerializer does not support untyped, free-form JSON data. As explained in Working with untyped JSON in a WCF service the System.Json namespace was added to Silverlight for this purpose, but it seems that it never made it into the full .Net class library.
Instead, in your stateless microservice can do a nested serialization where the free-form JSON is represented as an escaped string literal when serializing using the data contract serializer. Thus your classes would look something like this:
[DataContract]
[JsonObject]
public abstract class documentbase
{
[DataMember]
[JsonProperty]
public int id { get; set; }
[DataMember]
[JsonProperty]
public string type { get; set; }
[IgnoreDataMember]
[JsonProperty("content")]
public abstract JToken JsonContent { get; set; }
[JsonIgnore]
[DataMember(Name = "content")]
string DataContractContent
{
get
{
if (JsonContent == null)
return null;
return JsonContent.ToString(Newtonsoft.Json.Formatting.None);
}
set
{
if (string.IsNullOrEmpty(value))
JsonContent = null;
else
JsonContent = JToken.Parse(value);
}
}
}
[DataContract]
[JsonObject]
public class document : documentbase
{
JToken content;
public override JToken JsonContent { get { return content; } set { content = value; } }
}
[DataContract]
[JsonObject]
public class document<T> : documentbase where T : class
{
[IgnoreDataMember]
[JsonIgnore]
public T Content { get; set; }
public override JToken JsonContent
{
get
{
if (Content == null)
return null;
return JToken.FromObject(Content);
}
set
{
if (value == null || value.Type == JTokenType.Null)
Content = null;
else
Content = value.ToObject<T>();
}
}
}
Then the JSON generated by SerializeObject<document>(A) will look like:
{
"content":"{\"x\":1,\"y\":2}",
"id":1,
"type":"A"
}
Then, on the receiving system, you can deserialize to a document using the data contract serializer, then query the deserialized JToken JsonContent with LINQ to JSON. Alternatively, if the receiving system knows to expect a document<acontent> it can deserialize the data contract JSON as such, since document and document<T> have identical data contracts.
Have you looked into changing away from DataContractSerializer to a serializer with better support instead? Here's how you'd plug in a different serializer.
class InitializationCallbackAdapter
{
public Task OnInitialize()
{
this.StateManager.TryAddStateSerializer(new MyStateSerializer());
return Task.FromResult(true);
}
public IReliableStateManager StateManager { get; set; }
}
class MyStatefulService : StatefulService
{
public MyStatefulService(StatefulServiceContext context)
: this(context, new InitializationCallbackAdapter())
{
}
public MyStatefulService(StatefulServiceContext context, InitializationCallbackAdapter adapter)
: base(context, new ReliableStateManager(context, new ReliableStateManagerConfiguration(onInitializeStateSerializersEvent: adapter.OnInitialize)))
{
adapter.StateManager = this.StateManager;
}
}
This could be newtonsoft or whatever. Also I believe that the method is currently marked "Deprecated" however there's no alternative, so if it solves your problem go ahead and use it.

Parse complex JSON: multiple loops vs. classes

I have a Json of type :
{
"JobProcessors": [
{
"JobName": "ArchivalJob",
"IsEnabled": true,
"Batching": {
"BatchSize": 0,
"DegreeOfParallelism": -1
},
"Settings": {
"ArchivalJobCollectionPageSize": 50
}
},
{
"JobName": "AuditLogJob",
"IsEnabled": false,
"Batching": {
"BatchSize": 10,
"DegreeOfParallelism": -1
},
"Settings": {}
}
],
"ScheduledJobs": [
{
"JobName": "RemoteStartClientCommandJob",
"PrimaryAction": {
"ConnectionString": "#JobProcessorsIntegrationSBConnectionStringValue#",
"Settings": {
"LeadTimeInSeconds": "600",
"MaxSrsJobCount": 25
}
},
"ErrorAction": {
"ConnectionString": "#PairedJobProcessorIntegrationSBConnectionStringValue#",
"EntityPath": "remotestartqueue",
"Settings": {
"LeadTimeInSeconds": "600",
"MaxSrsJobCount": 25
}
}
}
]
}
I want to check the "IsEnabled" property for all "JobName" for which come under "JobProcessors" category.
In C# what i Have used till now is :
dynamic parsedJson = JsonConvert.DeserializeObject(reader.GetString(1));
foreach (var item in parsedJson)
{
foreach (var smallitem in item)
{
foreach (var tag in smallitem)
{
if(tag.IsEnabled.toString()=="true"){
Console.WriteLine("true");
}
}
}
}
This is giving me correct result except the fact that it also iterates for "ScheduledJobs" . But the main issue is :
Is this the right or most efficient way to do this ? If possible suggest some better method .
One that i know of is using classes , but i may not know the json structure beforehand. Also the json is very huge so making classes can be cumbersome !!
Given that you are already doing JObject.Parse(jsonstring); to parse your JSON string, you can use SelectTokens() with a JSONPath query to find all "JobName" objects under "JobProcessors":
// I want to check the "IsEnabled" property for all "JobName" for which come under "JobProcessors"
foreach (var job in root.SelectTokens("..JobProcessors[?(#.JobName)]"))
{
var isEnabled = (bool?)job["IsEnabled"];
Debug.WriteLine(string.Format("Job {0}: IsEnabled={1}", job["JobName"], isEnabled));
}
Notes:
.. is the recursive descent operator: it recursively descends the JToken hierarchy returning each item, subsequently to be matched against the remaining parts of the query string.
JobProcessors returns values of properties of that name.
[?(#.JobName)] returns array items (of JobProcessors in this case) that are objects with a JobName property.
(bool?) casts the value of "IsEnabled" to a boolean or null if missing.
And the output of this is:
Job ArchivalJob: IsEnabled=True
Job AuditLogJob: IsEnabled=False
As in your code snippet we are using two foreach it may take time for large object. So we can do the same thing in a single foreach or if you have some specific node to fetch or search we can use linq, and for this first we need to convert our json object into c# object. For converting Json object to C# you can use this site "http://json2csharp.com/" then we can Deserialize Json object into c#.
It will be something like this
string jsonString = "your Json Object as string";
var jsonObject = JsonConvert.DeserializeObject<RootObject>(jsonString);
foreach (JobProcessor obj in jsonObject.JobProcessors)
{
string JobName = obj.JobName;
bool value=obj.IsEnabled;
}
And I also converted given Json in c# object if the Json object is same you can directly use these classes.
public class Batching
{
public int BatchSize { get; set; }
public int DegreeOfParallelism { get; set; }
}
public class Settings
{
public int ArchivalJobCollectionPageSize { get; set; }
}
public class JobProcessor
{
public string JobName { get; set; }
public bool IsEnabled { get; set; }
public Batching Batching { get; set; }
public Settings Settings { get; set; }
}
public class Settings2
{
public string LeadTimeInSeconds { get; set; }
public int MaxSrsJobCount { get; set; }
}
public class PrimaryAction
{
public string ConnectionString { get; set; }
public Settings2 Settings { get; set; }
}
public class Settings3
{
public string LeadTimeInSeconds { get; set; }
public int MaxSrsJobCount { get; set; }
}
public class ErrorAction
{
public string ConnectionString { get; set; }
public string EntityPath { get; set; }
public Settings3 Settings { get; set; }
}
public class ScheduledJob
{
public string JobName { get; set; }
public PrimaryAction PrimaryAction { get; set; }
public ErrorAction ErrorAction { get; set; }
}
public class RootObject
{
public List<JobProcessor> JobProcessors { get; set; }
public List<ScheduledJob> ScheduledJobs { get; set; }
}
Hope this will help.
Thank you

Categories

Resources