简体   繁体   中英

catching error json string from facebook api

i am trying to catch error messages, that are sent from the facebook api when trying to post to a wall.

here is the json string that gets returned. {"error":{"message":"(#506) Duplicate status message","type":"OAuthException","code":506,"error_data":{"kError":1455006}}}

how would i parse this string using the JavaScriptSerializer, as if i try to use the word "error" in a class as my property, it will not allow it as its a keyword in c#. code is below.

Dim dbg As StreamReader = New StreamReader(e.Response.GetResponseStream)
Dim jss = New JavaScriptSerializer()
Dim fbdebug As fbDebuger = jss.Deserialize(Of fbDebuger)(dbg.ReadToEnd)
Response.Write(fbdebug.error)

Public Class fbDebuger Public Property error As String

End Class

可以通过在变量名称周围添加方括号来使用关键字。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM