Q:

ESRI REST API - Vehicle Routing Problem - Invalid JSON for GPFeatureRecordSetLayer

I am making a call to the ESRI VRP REST endpoint documented here: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Vehicle_Routing_Problem_service/02r3000000n4000000/
First, despite the url being in the format of a GET request, you have to submit it as a POST request or you get a 403.  I have been able to submit a job but my job errors out with the following error:
{
  "type":"esriJobMessageTypeError",
  "description":"Invalid value for parameter Orders - Details : Invalid JSON for GPFeatureRecordSetLayer or GPRecordSet datatype "
}

I have quite a long set of orders, and initially thought that the problem might be that the url is getting cut off, so I moved all the relevant data to url based parameters.  In both cases the error is the same.  Here is a summary of my order object (the full object can be viewed here: https://pastebin.com/KY6rBT1d) I am including two objects cause they constructed two different ways in my system.  
{
    "features": [{
        "geometry": {
            "x": -84.501880199286,
            "y": 38.042953690265
        },
        "attributes": {
            "Name": "C57O1535",
            "ServiceTime": 205,
            "PickupQuantities": "203 203 0 0"
        }
    },
    ...
    {
        "geometry": {
            "x": 4581925.8810913,
            "y": -9402862.099
        },
        "attributes": {
            "Name": "F27",
            "TimeWindowStart1": "08:40:00",
            "TimeWindowEnd1": "08:50:00",
            "MaxViolationTime1": 0,
            "ServiceTime": 6,
            "DeliveryQuantities": "4 0 3 2"
        }
    }
]}

I have checked it's validity using jsonlint in the case of the url, I tried removing the {features: ... } enclosure.  

A:

As is so often the case, I found the solution to this problem while writing up the question.  Notice that the coordinates of the second sample order are not in the same projection as the first order.  The Esri REST api assumes all orders are in the same projection.  It assumes you are in lat/long (wkid:4326) but allows you to specify other projections.  
In this case Invalid JSON meant wrong coordinate projection.  The final object in the orders array should look something like:
{
        "geometry": {
            "x": -84.8810913,
            "y": 38.099
        },
        "attributes": {
            "Name": "F27",
            "TimeWindowStart1": "08:40:00",
            "TimeWindowEnd1": "08:50:00",
            "MaxViolationTime1": 0,
            "ServiceTime": 6,
            "DeliveryQuantities": "4 0 3 2"
        }
}

