I'm consuming some ARCGis web services, and they have some unfortunate JSON design. for example, they might give something like this:
{
geometryType: "esriGeometryPolygon"
geometry: {
-rings: [
-[.blah..... }}
Now, depending on the geometryType value passed in, the geometry object may be one of several different object types. in the case above, the geometry node is of type Polygon.
so, question is; in JSON.NET is there any way to notate this conditional typing? if not (which i doubt there is), is there a way to build a provider for deserializing that geometry node, based on the object info above? if not, are there any recommended ways for solving this?
edit: i looked pretty extensively into building a custom converter, but the problem with the converter is that they have this abstract method:
public override T Create (Type objectType)
however, i have no way of knowing what type to create here, i need to know what kind of object was specified in the JSON above.
thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…