[{"email":"john.doe@sendgrid.com","timestamp":1337197600,"smtp-id":"<4FB4041F.6080505@sendgrid.com>","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337966815,"smtp-id":"<4FBFC0DD.5040601@sendgrid.com>","category":"newuser","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337969592,"smtp-id":"<20120525181309.C1A9B40405B3@Mohammeds-Mac.local>","event":"processed"},{"email":"bill.nye@thescienceguy.com","timestamp":1337971272,"smtp-id":"<20120525184109.9578F40409A5@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"bill.nye@thescienceguy.com","timestamp":1337979680,"smtp-id":"<20120525210118.7F3724041B6D@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"bill.nye@thescienceguy.com","timestamp":1337980426,"smtp-id":"<20120525211344.2844C4041EB2@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"iamemail@gmail.com","attempt":"17","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337201407,"response":"501 Syntax error - Badly formatted address. ","event":"deferred"},{"email":"iamemail@gmail.com","attempt":"18","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337212247,"response":"Connection timed out","event":"deferred"},{"email":"iamemail@gmail.com","attempt":"25","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337288707,"response":"501 Syntax error - Badly formatted address. ","event":"deferred"},{"email":"john.doe@sendgrid.com","smtp-id":"<4FBFC0DD.5040601@sendgrid.com>","timestamp":1337966817,"response":"250 2.0.0 OK 1337966817 z9si3846029icy.10 ","category":"newuser","event":"delivered"},{"email":"john.doe@sendgrid.com","smtp-id":"<20120525183816.12AA6404092A@Mohammeds-Mac.local>","timestamp":1337971099,"response":"250 2.0.0 OK 1337971099 l10si4052001icz.31 ","event":"delivered"},{"email":"foobar@yahoo.com","smtp-id":"<20120525183951.59BEA4040968@Mohammeds-Mac.local>","timestamp":1337971198,"response":"250 2.0.0 OK 1337971198 xz10si2239282obb.108 ","event":"delivered"},{"email":"foobar@yahoo.com","smtp-id":"<20120525181029.220EE404043A@Mohammeds-Mac.local>","timestamp":1337969434,"status":"5.1.1","reason":"550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at http://support.google.com/mail/bin/answer.py?answer=6596 z6si25868142igk.15 ","type":"bounce","event":"bounce"},{"email":"john.doe@sendgrid.com","timestamp":1338574236,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338572978,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338595596,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338312226,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_id":"310318","newsletter_send_id":"425605"},"category":["dsfdsf","Newsletter"],"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1338487320,"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1338578578,"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1340126539,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_send_id":"478915","newsletter_id":"428128"},"category":["TESTt","Newsletter"],"event":"unsubscribe"},{"email":"john.doe@sendgrid.com","timestamp":1338310756,"newsletter":{"newsletter_user_list_id":"1695100","newsletter_send_id":"425584","newsletter_id":"331537"},"category":["TEST","Newsletter"],"event":"unsubscribe"},{"email":"john.doe@sendgrid.com","timestamp":1340126539,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_send_id":"478915","newsletter_id":"428128"},"category":["TESTt","Newsletter"],"event":"unsubscribe"},{"email":"mysendgriid@hotmail.com","event":"spamreport","timestamp":1347307636,"category":["board_collaborator_new_pin"],"unique_args":{"tracking_id":"c99z72cd5537515d9b0e3d8cab1ec09e","time_sent":1346814447,"sender_username":"notasendr","recipient_username":"realusername"}}]
Dim userName As String = Request.Form("UserName")
Dim password As String = Request.Form("Password")
[{"email":"john.doe@sendgrid.com","timestamp":1337197600,"smtp-id":"<4FB4041F.6080505@sendgrid.com>","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337966815,"smtp-id":"<4FBFC0DD.5040601@sendgrid.com>","category":"newuser","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337969592,"smtp-id":"<20120525181309.C1A9B40405B3@Mohammeds-Mac.local>","event":"processed"},{"email":"bill.nye@thescienceguy.com","timestamp":1337971272,"smtp-id":"<20120525184109.9578F40409A5@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"bill.nye@thescienceguy.com","timestamp":1337979680,"smtp-id":"<20120525210118.7F3724041B6D@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"bill.nye@thescienceguy.com","timestamp":1337980426,"smtp-id":"<20120525211344.2844C4041EB2@Mohammeds-Mac.local>","reason":"Unsubscribed Address","event":"dropped"},{"email":"iamemail@gmail.com","attempt":"17","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337201407,"response":"501 Syntax error - Badly formatted address. ","event":"deferred"},{"email":"iamemail@gmail.com","attempt":"18","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337212247,"response":"Connection timed out","event":"deferred"},{"email":"iamemail@gmail.com","attempt":"25","smtp-id":"<4FB29F5D.5080404@sendgrid.com>","timestamp":1337288707,"response":"501 Syntax error - Badly formatted address. ","event":"deferred"},{"email":"john.doe@sendgrid.com","smtp-id":"<4FBFC0DD.5040601@sendgrid.com>","timestamp":1337966817,"response":"250 2.0.0 OK 1337966817 z9si3846029icy.10 ","category":"newuser","event":"delivered"},{"email":"john.doe@sendgrid.com","smtp-id":"<20120525183816.12AA6404092A@Mohammeds-Mac.local>","timestamp":1337971099,"response":"250 2.0.0 OK 1337971099 l10si4052001icz.31 ","event":"delivered"},{"email":"foobar@yahoo.com","smtp-id":"<20120525183951.59BEA4040968@Mohammeds-Mac.local>","timestamp":1337971198,"response":"250 2.0.0 OK 1337971198 xz10si2239282obb.108 ","event":"delivered"},{"email":"foobar@yahoo.com","smtp-id":"<20120525181029.220EE404043A@Mohammeds-Mac.local>","timestamp":1337969434,"status":"5.1.1","reason":"550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces. Learn more at http://support.google.com/mail/bin/answer.py?answer=6596 z6si25868142igk.15 ","type":"bounce","event":"bounce"},{"email":"john.doe@sendgrid.com","timestamp":1338574236,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338572978,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338595596,"url":"http://www.sendgrid.com","event":"click"},{"email":"john.doe@sendgrid.com","timestamp":1338312226,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_id":"310318","newsletter_send_id":"425605"},"category":["dsfdsf","Newsletter"],"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1338487320,"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1338578578,"event":"open"},{"email":"john.doe@sendgrid.com","timestamp":1340126539,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_send_id":"478915","newsletter_id":"428128"},"category":["TESTt","Newsletter"],"event":"unsubscribe"},{"email":"john.doe@sendgrid.com","timestamp":1338310756,"newsletter":{"newsletter_user_list_id":"1695100","newsletter_send_id":"425584","newsletter_id":"331537"},"category":["TEST","Newsletter"],"event":"unsubscribe"},{"email":"john.doe@sendgrid.com","timestamp":1340126539,"newsletter":{"newsletter_user_list_id":"1695412","newsletter_send_id":"478915","newsletter_id":"428128"},"category":["TESTt","Newsletter"],"event":"unsubscribe"},{"email":"mysendgriid@hotmail.com","event":"spamreport","timestamp":1347307636,"category":["board_collaborator_new_pin"],"unique_args":{"tracking_id":"c99z72cd5537515d9b0e3d8cab1ec09e","time_sent":1346814447,"sender_username":"notasendr","recipient_username":"realusername"}}]
curl -X POST -H "Content-Type: application/json" -d '[{"email":"john.doe@sendgrid.com","timestamp":1337197600,"smtp-id":"<4FB4041F.6080505@sendgrid.com>","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337966815,"smtp-id":"<4FBFC0DD.5040601@sendgrid.com>","category":"newuser","event":"clicked"},{"email":"john.doe@sendgrid.com","timestamp":1337969592,"smtp-id":"<20120525181309.C1A9B40405B3@Example-Mac.local>","event":"processed"}]'
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Request.InputStream.Position = 0 'you need this else the magic doesn't happen
Dim inputStream As New StreamReader(Request.InputStream)
Dim json As String = inputStream.ReadToEnd()
'Dim nl As New Sendgrid
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, String) = jss.Deserialize(Of Dictionary(Of String, String))(json)
'We're telling it with the String, String to expect both the name of the value and the value as strings.
For Each item As KeyValuePair(Of String, String) In dict
Response.Write(item.Key & " - " & item.Value & "<br>")
If dict.ContainsKey("email") Then
'nl.Email = dict("email")
Insert(dict("email"))
End If
Next
'Dim nl As SendgridJsonConvert.DeserializeObject(Of Sendgrid)(json)
'Dim dict As Dictionary(Of String, String) =
'Response.Write(nl.Email)
End If
End Sub
Public Sub Insert(email As String)
Dim dbConn As New SqlConnection(config.ConnectionString)
Dim sqlString As String
sqlString = "INSERT INTO testSendgrid (email) VALUES (@email)"
Dim sqlCmd As New SqlCommand(sqlString, dbConn)
sqlCmd.CommandType = CommandType.Text
sqlCmd.Parameters.AddWithValue("@email", email)
Try
dbConn.Open()
sqlCmd.ExecuteNonQuery()
Finally
dbConn.Close()
sqlCmd = Nothing
dbConn = Nothing
End Try
End Sub
http://fastjson.codeplex.com/
Author's description of the project and performance comparisons to other JSON deserializing functions/methods/librarie
http://www.codeproject.com/Articles/159450/fastJSON