Json provider: parsing inappropriate data
I am processing messages. Each message corresponds to a coordinate, and MOST is in a specific JSON form. The problem is that some naughty messages are in the wrong format (different format where the whole list of coordinates is included in one message).
Ideally I would like to handle both types of messages, but the built-in Parse function for the JsonProvider seems to succeed even when the incoming data is in the wrong format. How can I know ahead of time (before trying to parse) what format my coordinate system is in?
My two data models look something like this:
type ModelA = JsonProvider<"""{
"id": "13222",
"timestamp": 1499329186332.0,
"latitude": 12.125419,
"longitude": 15.054884
}""">
type ModelB = JsonProvider<"""{
"data": {
"positions": [
{
"id": "13223",
"timestamp": 1499329186332.0,
"latitude": 12.125419,
"longitude": 15.054884
},
{
"id": "13223",
"timestamp": 1499329186332.0,
"latitude": 12.125419,
"longitude": 15.054884
}]
}
}""">
+3
source to share
No one has answered this question yet
See similar questions:
or similar: