c# - RestSharp: identifying JSON fields not in POCO -
i'm using restsharp
call rest api, , deserialize json pocos. , part, working well.
the challenge i'm facing api isn't documented. it's examples of returned json payloads each endpoint. i've used construct pocos endpoints.
but examples unreliable. of them show properties names make them sound child objects, example has property set null
, there's nothing go on poco.
conversely, properties i'm receiving aren't shown in example, if hadn't been scrutinizing json hand, wouldn't have known include them.
the first thing did contact api vendor. asked schemas, claim, improbably, not have any. examples documentation there is. don't have developer forum.
now ,restsharp
handles "more data expected" situation reasonably elegantly, in nothing blows up:
your classes define how want returned data deserialized. instead of traversing data , searching matching property in class, restsharp uses class starting point, looping through each publicly-accessible, writable property , searching corresponding element in data returned.
(source: https://github.com/restsharp/restsharp/wiki/deserialization)
that's nice. want notified - programmatically - when receiving data poco can't capture. @ least notify operator more development needs done.
is aware of extension or addition this? rather not write own deserializer add in functionality.
this question looks similar mine, looks refers earlier version of restsharp
did blow in situation. , since of pocos map relational database tables, opposite of "flexible", solution using dynamics
won't meet needs @ all.
Comments
Post a Comment