csharp-sparkpost
                                
                                 csharp-sparkpost copied to clipboard
                                
                                    csharp-sparkpost copied to clipboard
                            
                            
                            
                        Getting "422 Unprocessable Entity" for JSON (.json) attachment
I'm attaching a .json file (named "data.json") with type application/json via File.Create<Attachment>(byte[], string) and getting this response when sending the transmission:
Response: 422 Unprocessable Entity. Content: { "errors": [ { "message": "invalid data format\/type", "description": "field 'content.attachments[0].type' is of type 'json_array', but needs to be of type 'string'", "code": "1300" } ] }.
JSON part:
{
  "errors": [{
      "message": "invalid data format/type",
      "description": "field 'content.attachments[0].type' is of type 'json_array', but needs to be of type 'string'",
      "code": "1300"
    }
  ]
}
Note: I'm explicitly setting the type to application/json because MimeMapping.GetMimeMapping doesn't recognize the .json file extension.