我有以下格式的 JSON:
[{"fingerprint":"[79,0,0,0,18,0,0,0,18,0,0,0,19,0,0,0,23,0,0,0,40,0,0,0,42,0,0,0,63,0,0,0,68,0,0,0,71,0,....]"}]
我一直在尝试使用以下方法从中提取字节数组:
JSONFingerprint fingerprintData = gson.fromJson(obj, JSONFingerprint.class);
JSONFingerprint 在哪里:
public class JSONFingerprint {
byte[] fingerprint;
public byte[] getfingerprintData() {
return fingerprint;
}
}
我一直收到此错误:
Exception in thread "Thread-0" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176)
at com.google.gson.Gson.fromJson(Gson.java:795)
at com.google.gson.Gson.fromJson(Gson.java:859)
at com.google.gson.Gson.fromJson(Gson.java:832)
有人有什么想法吗??