Based on your short description, "JSON to DWG" would mean that your app (Acad addin) calls a servcies that returns data (likely, geometry data) that can be used to buld AutoCAD entities, such as line, polylines, arcs. circles.... most likely closed polylines, since you get data from ARCGIS services. The data from the services would be in Jason format.
So, what you'll do something like:
1. Use either WebClient (older technology), or HttpClient (latest technology) to call the services to get the data in Json format;
2. Then use one of the available Json utility (Json.NET from NewtonSoft is most popular to be used in client side/desktop app) to desearize the json string into a a custom class, which you create according to the Json data structure.
3. Once you have all data in your own custom data model, do whatever you want to create Acad entities.
You can search HpptClient on the net for some code example.
For example, assune a service call returns Json data, representing a circle, like this:
{
'Radius': 20.0,
'CenterX': 1.0,
'CenterY': 1.0,
'CenterZ': 0.0
}
Then you can create a custom class like this
public class GisCircle
{
public double Radius{set;get;}
public double CenterX {set;get;}
public double CenterY {set;get;}
public double CenterZ {set;get;}
public Point3d Center { get {return new Point3d(CenterX, CenterY,CenterZ);}}
}
In the data access code, you use HttpClient to access the services to get data, like this:
public async Task<GisCircle> GetCircle(string queryUrl)
{
GisCircle circle=null;
var client = new HttpClient();
client.BaseAddress=new Uri("https://....../");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = await client.GetAsync(queryUrl);
if (response.IsSuccessStateCode)
(
circle=await response.Content.ReadAsAsync<GisCircle>();
)
return circle;
}
Obviously the example is extremely simplified. The Json data from the ARCGIS services could be quite complicated. But the process would be the same, or very similar. And you very likely need to use Json.NET library to parse the json string into more complicated custom data classes/models.
I assume that once you are able to translate the Json data into your own data structure/model, you should be able to use it in whatever way in the process of ccreating corresponding Acad entities.
So, you would focus on how to call the service with HttpClient and translate the Json data into your own data model. As long as you correctly collect the required geometry information from the returned json data, it would not a an issue to create Acad entities.
At my work, most our CAD applications need to have access to backend enterprise database for varieties of data. In the past, the access is direct connection to the database (using ADO.NET, SQL Server). Now the company is a huge global one, so all the database accesses have been through backend services (REST services, all data returned in Json format). The process of accessing data from backend services and then do something in our Acad add-in apps would not be much different from what you want to do.
Hope this helps a bit.