Generating C# classes for tables

thedavegray
Giga Expert

Hi, 

 

Can anyone please tell me the quickest/safest way to generate C# entity classes for the various ServiceNow table (endpoints?) ? 

 

I have gone down a bit of a rabbit hole in generating C# classes from the json response using online converters such as https://json2csharp.com/

 

The problem I am finding (obvious with hindsight) is that a response that has 100 json elements will generate different class than a request that has 500 elements, because the online converter using the values it finds to work out the type. 

 

An example is Incident.u_template, based on a low sample rate this is empty so is classed as a string, however based on 100 elements it looks to return an object. 

 

u_template.png

 

 

My class looks like this: 

u_template2.png

 

Though on a large sample the online converter classifies it as an object. 

 

public object UTemplate;

 

Full Incident class attached

 

Thanks 

 

0 REPLIES 0