JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Invalid escape sequence at line

简介: JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Invalid escape sequence at line

问题场景:

当时在做数据上传的时候,遇到的。

最后发现问题的所在,在提交数据到API中时,我当时只上传了一条数据,用户的提交意见,而数据表中的其他数据,没有进行上传,比如用户ID,phone…

凡是数据列表中,存在的成员变量,都要给其赋值,才能成功上传数据,即使你用到的数据,只有其中的几条。

在实体类中,赋值ID,和当前时间,可以直接赋值

AlarmRecordID= UUID.randomUUID().toString();
        DiagnosticTime=DateUtil.getNowDateTime("yyyy-MM-dd HH:mm:ss");
        CreateDate=DateUtil.getNowDateTime("yyyy-MM-dd HH:mm:ss");
        ModifyDate=DateUtil.getNowDateTime("yyyy-MM-dd HH:mm:ss");

在上传时,赋值… 数据全部要赋值,不能为空

case R.id.btn_submit_opinion:
                    SoundAlarmRecord soundAlarmRecord=new SoundAlarmRecord();
                    soundAlarmRecord.Diagnostic=edit_diagnostic_opinion.getText().toString();
                    soundAlarmRecord.DiagnosticUser=this.phone;
                    soundAlarmRecord.SoundPointCode=this.SoundPointCode;
                    soundAlarmRecord.IsDiagnostic="1";
                    soundAlarmRecord.IsSendMsg="0";
                    soundAlarmRecord.IsSoundAlarm="0";
                    soundAlarmRecord.IsTempAlarm="0";
                    soundAlarmRecord.Creator=this.phone;
                    soundAlarmRecord.Modifier=this.phone;
                    if (TextUtils.isEmpty(soundAlarmRecord.Diagnostic)){
                        Toast.makeText(RecordplayActivity.this, "提交诊断意见不能为空!", Toast.LENGTH_SHORT).show();
                    }else {
                        SubmittextFile(soundAlarmRecord);
                        btn_submit_opinion.setEnabled(false);
                    }

在这里记录一下,有同样问题的可以参考借鉴…


目录
相关文章
|
8月前
QSoundEffect(qaudio): Error decoding source
QSoundEffect(qaudio): Error decoding source
143 0
|
3月前
Google Earth Engine(GEE)——ImageCollection.fromImages, argument ‘images‘: Invalid type. Expected type
Google Earth Engine(GEE)——ImageCollection.fromImages, argument ‘images‘: Invalid type. Expected type
26 0
|
8天前
|
索引
Elasticsearch exception [type=illegal_argument_exception, reason=index [.1] is the write index for data stream [slowlog] and cannot be deleted]
在 Elasticsearch 中,你尝试删除的索引是一个数据流(data stream)的一部分,而且是数据流的写入索引(write index),因此无法直接删除它。为了解决这个问题,你可以按照以下步骤进行操作:
|
22天前
|
JSON JavaScript API
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 错误分析
本文探讨了Python中处理JSON数据时遇到的`JSONDecodeError`,该错误通常由JSON格式错误或数据源问题引起。解决方法包括检查数据源、使用异常处理机制和调试日志记录。示例代码展示了如何从文件和API读取JSON并处理异常。注意事项涉及验证JSON规范、处理特殊字符和选择合适解析器。通过这些步骤,可以有效解决JSON解码错误,确保数据正确解析。
26 0
|
2月前
|
JSON 数据格式
“JSON parse error: Unexpected character (‘1‘ (code 49))的解决方式
“JSON parse error: Unexpected character (‘1‘ (code 49))的解决方式
31 0
|
3月前
|
前端开发
Google Earth Engine(GEE)——argument ‘input‘: Invalid type. Expected type: Image<unknown bands>错误
Google Earth Engine(GEE)——argument ‘input‘: Invalid type. Expected type: Image<unknown bands>错误
28 0
|
6月前
|
XML 编解码 数据格式
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
164 0
|
7月前
|
JSON 数据格式
JsonParseException: Unexpected character (‘ï‘ (code 239)): was expecting comma to separate Object
JsonParseException: Unexpected character (‘ï‘ (code 239)): was expecting comma to separate Object
57 0
|
8月前
Uniapp Syntax Error: Error: Unbalanced delimiter found in string
Uniapp Syntax Error: Error: Unbalanced delimiter found in string
120 0
|
9月前
|
Python
Python POST data should be bytes, an iterable of bytes, or a file object. It ...
Python POST data should be bytes, an iterable of bytes, or a file object. It ...
75 0