我收到了SignalR服务器的响应(用ASP.NET C#编写)
"$type":"Microsoft.AspNet.SignalR.Hubs.ClientHubInvocation, Microsoft.AspNet.SignalR.Core","H":"MyHub","M":"MyHubMethod","A":{"$type":"System.Object[], mscorlib","$values":[{"$type":"System.Collections.Generic.List`1[[System.Tuple`2[[System.Int64, mscorlib],[System.Collections.Generic.List`1[[Client.Common.ObjA, Client.Common]], mscorlib]], mscorlib]], mscorlib","$values":[{"$type":"System.Tuple`2[[System.Int64, mscorlib],[System.Collections.Generic.List`1[[Client.Common.ObjA, Client.Common]], mscorlib]], mscorlib"
使用以下代码:
proxy.on(Constants.JOURNAL_HUB_METHOD,
new SubscriptionHandler1<Object[]>() {
@Override
public void run(Object[] objList) {
Log.d(TAG, "SignalR reply: " + objList.length);
}
}, Object[].class);
我收到以下错误:
com.android.com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期为BEGIN_ARRAY但是为BEGIN_OBJECT
是因为JSON响应包含类型吗?或者因为它是从C#代码发送到java代码的?