01-21 13:21:30.584 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Unterminated string at character 990 of [{"teleStackDirection":0,"teleCoopSet":0,"autoTotes":0,"teleCoopStack":0,"autoProgs":0,"telePlatform":0,"teleStackTotes":0,"mechLitterPusher":false,"mechLitterInserter":false,"teamNum":0,"mechToteFeeder":false,"teleCarryTote":0,"autoPos":0,"autoMoveTote":false,"mechContainerFlipper":false,"teleHumanStation":0,"id":"6d1d1c80-d386-401c-91c7-3260fdb28a9b","autoMove":false,"telePickUpLitter":false,"autoContainers":0,"teleMoveLitter":false,"teleStackContainers":0,"mechContainerStepRemover":false,"telePlaceTote":0,"telePlaceLitter":0},{"teleStackDirection":0,"teleCoopSet":0,"autoTotes":0,"teleCoopStack":0,"autoProgs":0,"telePlatform":0,"teleStackTotes":0,"mechLitterPusher":false,"mechLitterInserter":false,"teamNum":1,"mechToteFeeder":false,"teleCarryTote":0,"autoPos":0,"autoMoveTote":false,"mechContainerFlipper":false,"teleHumanStation":0,"id":"e10f158f-7254-4bfb-85eb-eb402be790c3","autoMove":false,"telePickUpLitter":false,"autoContainers":0,"teleMoveLitter":false,"teleStackContain
01-21 13:21:30.618 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value toPos" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.648 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value kContainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.656 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value lse of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.662 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value e of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.728 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value gs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.734 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value gs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.740 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value {"teleCoopSet":0,"teleStackDirection":0,"autoTotes":0,"autoProgs":0,"teleCoopStack":0,"mechLitterPusher":false,"teleStackTotes":0,"telePlatform":0,"mechLitterInserter":false,"teamNum":34,"mechToteFeeder":false,"autoMoveTote":false,"autoPos":0,"teleCarryTote":0,"mechContainerFlipper":false,"teleHumanStation":0,"id":"c2108315-2ea6-4cd5-8205-c845ae48739c","autoMove":false,"autoContainers":0,"telePickUpLitter":false,"teleStackContainers":0,"teleMoveLitter":false,"mechContainerStepRemover":false,"telePlaceLitter":0,"telePlaceTote":0} of type org.json.JSONObject cannot be converted to JSONArray
01-21 13:21:30.757 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value {"teleCoopSet":0,"teleStackDirection":0,"autoTotes":0,"autoProgs":0,"teleCoopStack":0,"mechLitterPusher":false,"teleStackTotes":0,"telePlatform":0,"mechLitterInserter":false,"teamNum":34,"mechToteFeeder":false,"autoMoveTote":false,"autoPos":0,"teleCarryTote":0,"mechContainerFlipper":false,"teleHumanStation":0,"id":"c2108315-2ea6-4cd5-8205-c845ae48739c","autoMove":false,"autoContainers":0,"telePickUpLitter":false,"teleStackContainers":0,"teleMoveLitter":false,"mechContainerStepRemover":false,"telePlaceLitter":0,"telePlaceTote":0} of type org.json.JSONObject cannot be converted to JSONArray
01-21 13:21:30.775 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value {"teleCoopSet":0,"teleStackDirection":0,"autoTotes":0,"autoProgs":0,"teleCoopStack":0,"mechLitterPusher":false,"teleStackTotes":0,"telePlatform":0,"mechLitterInserter":false,"teamNum":34,"mechToteFeeder":false,"autoMoveTote":false,"autoPos":0,"teleCarryTote":0,"mechContainerFlipper":false,"teleHumanStation":0,"id":"c2108315-2ea6-4cd5-8205-c845ae48739c","autoMove":false,"autoContainers":0,"telePickUpLitter":false,"teleStackContainers":0,"teleMoveLitter":false,"mechContainerStepRemover":false,"telePlaceLitter":0,"telePlaceTote":0} of type org.json.JSONObject cannot be converted to JSONArray
01-21 13:21:30.777 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value ners" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.781 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value lePickUpLitter" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.787 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value HumanStation" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.794 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value CarryTote" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.801 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value sher" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.807 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value teleCoopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.866 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value chToteFeeder" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.873 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value ackTotes" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.879 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopSet" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.886 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value ver" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.894 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.900 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.904 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.905 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.908 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.909 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.911 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.912 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.914 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.915 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.916 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value tainers" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.958 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value eStackDirection" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.967 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value kUpLitter" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.974 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Tote" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.981 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.988 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.992 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.994 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:30.995 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value oopStack" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.042 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.048 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.053 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.055 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.056 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.058 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.059 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.063 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.065 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value Flipper" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.123 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.127 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.133 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.135 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.137 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.139 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:21:31.141 9596-9596/org.huntingtonrobotics.frcrecyclerushpitscouter D/FRCRecycleRushPitScouterJSONSerializer﹕ Error: org.json.JSONException: Value rs" of type java.lang.String cannot be converted to JSONArray
01-21 13:26:07.836 12185-12185/org.huntingtonrobotics.frcrecyclerushpitscouter I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM build: (N/A)
OpenGL ES Shader Compiler Version: E031.24.00.00
Build Date: 11/12/13 Tue
Local Branch:
Remote Branch:
Local Patches:
case Constants.MESSAGE_WRITE:
byte[] writeBuf = (byte[]) msg.obj;
// construct a string from the buffer
String writeMessage = mConversationJSONString;
mConversationArrayAdapter.add("Me: " + writeMessage);
break;
case Constants.MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = new String(readBuf, 0, msg.arg1);
//Log.i(TAG, readMessage);
try {
mSerilizer.saveBluetoothTeams(readMessage);
}catch (JSONException je){
Log.d(TAG, "Error: " + je);
}catch (Exception e){
Log.d(TAG, "Error: " + e);
}
mConversationArrayAdapter.add(mConnectedDeviceName + ": " + readMessage);
break;
//returns string version of json file
public String getJSONString() throws JSONException, IOException{
//Build an array in JSON
JSONArray array = new JSONArray();
loadTeams();
for (Team c : mTeams) {
array.put(c.toJSON());
}
return array.toString();
}
//load teams from file system
public Boolean saveBluetoothTeams(String s) throws IOException, JSONException {
BufferedReader reader = null;
try {
//parse the JSON using JSONTokener
JSONArray jsonArray = new JSONArray(s);
ArrayList<Team> bluetoothListData = new ArrayList<Team>();
//build the array of teams from JSONObjects
for (int i = 0; i < jsonArray.length(); i++) {
bluetoothListData.add(new Team(jsonArray.getJSONObject(i)));
}
mTeams.addAll(bluetoothListData);
saveTeams(mTeams);
return true;
}catch (FileNotFoundException e) {
//ignore
return false;
}catch (Exception e){
Log.d(TAG, "Error: " + e);
return false;
}finally {
//ensures the underlying file handle is freed up
if (reader != null)
reader.close();
}
}
完整的蓝牙聊天服务类:https://github.com/frcteam1501/frcrecyerushpitscouter/blob/master/app/src/main/java/org/huntingtonrobotics/frcrecyerushpitscouter/bluetoothchat/bluetoothchatfragment.java
完整的蓝牙聊天片段类:https://github.com/frcteam1501/frcrecyerushpitscouter/blob/master/app/src/main/java/org/huntingtonrobotics/frcrecyerushpitscouter/bluetoothchat/bluetoothchatfragment.java
@tanis.7x是正确的,我收到了我的数据块。但是,我无法使对象输入/输出流工作,所以我使用了以下方法:
>
创建一些随机字符放在通过蓝牙发送的数据的末尾。
//to put on end of string being sent over bluetooth
private static final String SUPER_SECRET_PASSWORD = "~~~";
创建一个字符串,作为保存所有块的最后一个字符串
//for building final string from bluetooth receiver since JSONString was being received in chunks
private String mFinalString = "";
if ((mFinalString.substring(mFinalString.length()-SUPER_SECRET_PASSWORD.length()).equals(SUPER_SECRET_PASSWORD))){
try {
//remove the super secret password from mFinalString
mFinalString = mFinalString.substring(0, mFinalString.length()- SUPER_SECRET_PASSWORD.length());
//print mFinalString out in the TextView
mConversationArrayAdapter.add(mConnectedDeviceName + ": " + mFinalString);
//process mFinalString in the Serializer
mSerializer.saveBluetoothTeams(mFinalString);
//clear mFinalString
mFinalString = "";
Toast.makeText(activity, "Teams Received. Please close your app and restart to reload teams.", Toast.LENGTH_LONG).show();
}catch (Exception e){
Log.e(TAG, "ERROR Saving mFinalString: " + e);
}
}
问题内容: 我有String变量称为: 现在,我想将其转换为JSON对象。我在Google上搜索了更多内容,但没有得到任何预期的答案… 问题答案: 使用org.json库:
这个问题的范围是JSON处理的JavaAPI(JSR 353)。 给定一个元素为JsonString的JsonArray,我如何轻松地将其转换为
问题内容: 我有以下asp.net核心LINQ代码: 不幸的是,这转化为以下内容: 我不知道为什么会有这部分: 不仅像 非常感谢 问题答案: EF Core中SQL转换的规则尚不清楚,远未完善,尚在讨论中,并且随着每个次要发行版的发布而不断变化。 的翻译,并进行了讨论,并改了好几次- 例如,问题#474:查询:提高字符串的StartsWith,的endsWith的翻译和包含)。的翻译已经在最新的官
问题内容: 我有一些Objective-C的遗留代码,它声明了像 如此处所写https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/AdoptingCocoaDesignPatterns.html Swift自动将产生错误的Objective-C方法转换为根据Swift的本机错
我使用下面的库转换我的html div到画布。 https://html2canvas.hertzen.com/ 事情按预期进行。现在,我想要的基本上不是下载(通过saveAsPNG()方法可以下载),而是将数据发送到服务器。现在我们知道,我们需要使用toDataUrl()将其转换为base64。 使用此方法toDataUrl(),表示不是函数。 下面是片段 1) 以画布形式提供输出 2)canv
我有一个JSF应用程序,除了调用ManagedBean中以对象为参数的方法外,其他一切都运行得很好: 在SCONTR中: 所有没有自己定义的对象的方法都可以工作(例如,映射、字符串、列表等),访问xhtml中的对象甚至子对象就像一个魅力。 但是,调用此deletePrivilege会导致: 因此,出于某种原因,JSF无法将LinkedHashMap自动转换回用于呈现页面的类的实例。 faces-c