如何从POST请求发送JSON数据使JSON对象变白

如何从POST请求发送JSON数据使JSON对象变白,json,jackson,postman,spring-restcontroller,Json,Jackson,Postman,Spring Restcontroller,如何从SpringREST控制器的POST主体中的POST请求向WhitenJSON对象发送JSON数据。 我需要将此数据保存到Postgres DB,它的列类型是JSON 我需要将邮递员发出的bellow JSON作为POST请求发送到SPring Rest控制器,但我无法将数据保存在控制器中,控制器将为空,但当我给出列表时,我得到以下错误 JSON解析错误:无法反序列化java.util.ArrayListout-of-START\u对象标记的实例;嵌套异常为com.fasterxml.ja

如何从SpringREST控制器的POST主体中的POST请求向WhitenJSON对象发送JSON数据。 我需要将此数据保存到Postgres DB,它的列类型是JSON

我需要将邮递员发出的bellow JSON作为POST请求发送到SPring Rest控制器,但我无法将数据保存在控制器中,控制器将为空,但当我给出列表时,我得到以下错误

JSON解析错误:无法反序列化
java.util.ArrayList
out-of-START\u对象标记的实例;嵌套异常为com.fasterxml.jackson.databind.exc.MismatchedInputException:无法在[Source:(PushbackInputStream);第1行,第1列]处反序列化
java.util.ArrayList
out-of-START_对象标记的实例, “路径”:“/configJsondata”

来自Postman的输入Json为:

{
 "GenericValidation":[{"MinimumFieldsCheck":true},{"MirrorCopyAccountCheck":true},{"DuplicateAccountCheck":false},{"CleanClaimCheck":false},{"Segregating":true}],
 "HL7Specification":[{"MinimumFieldsCheck":true},{"MirrorCopyAccountCheck":true},{"DuplicateAccountCheck":false},{"CleanClaimCheck":false},{"Segregating":true}]
}

@PostMapping(value = "facility/insertConfig")
public ResponseEntity<?> insertCoderConfiguration(@RequestBody CoderConfigvalue requestvalue) {
int status = 0;
try {

    status = coderInboxFetchRecordsService.saveCoderConfiguration(requestvalue);

} catch (Exception e) {
    LOGGER.error(" Exception while fetching record from DB", e.getMessage());
}

return ResponseEntity.status(HttpStatus.OK).body(status);
}


public class CoderConfigvalue implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = -1749526768701725321L;
private String facilitycode;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_EMPTY)
@JsonProperty("GenericValidation")
private List<Map<String, Boolean>> GenericValidation;
@JsonInclude(Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonProperty("HL7Specification")
private List<Map<String, Boolean>> HL7Specification;
{
“GenericValidation”:[{“MinimumFieldsCheck”:true},{“MirrorCopyAccountCheck”:true},{“DuplicateCountCheck”:false},{“CleanClaimCheck”:false},{“Segrating”:true},
“HL7Specification”:[{“MinimumFieldsCheck”:true},{“MirrorCopyAccountCheck”:true},{“DuplicateCountCheck”:false},{“CleanClaimCheck”:false},{“隔离”:true}]
}
@后映射(value=“facility/insertConfig”)
public ResponseEntity insertCoderConfiguration(@RequestBody CoderConfigvalue requestvalue){
int status=0;
试一试{
状态=coderInboxFetchRecordsService.saveCoderConfiguration(requestvalue);
}捕获(例外e){
LOGGER.error(“从数据库获取记录时出现异常”,e.getMessage());
}
返回ResponseEntity.status(HttpStatus.OK).body(status);
}
公共类CoderConfigvalue实现可序列化{
/**
* 
*/
私有静态最终长serialVersionUID=-1749526768701725321L;
私有字符串设施代码;
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonInclude(Include.NON_EMPTY)
@JsonProperty(“GenericValidation”)
私有列表通用验证;
@JsonInclude(Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown=true)
@JsonProperty(“HL7Specification”)
私有列表HL7规范;

这不是一个列表,它是一个单一的对象。您不能从单一的对象创建列表。请确保您真正理解您正在使用的JSON的结构和语法。此外,您没有向我们显示导致错误的代码,因此帮助您更正错误(除了建议您可能反序列化到错误的结构)不可能。@ADyson我的意思是hwo我可以将它传递给我的控制器并存储在DBwell中。看起来您的控制器可能正在接收它,但它无法将其反序列化为对象,因为您告诉它将其反序列化为列表结构,而JSON不是列表(它是单个对象)。虽然很难确定,因为我们没有任何代码,也不知道您从PostMan发送请求的准确程度。您是说您只想将原始JSON字符串直接存储到数据库的字段中,而不是反序列化其内容?另外,请再次显示您的代码。我们无法修复我们看不到的内容。@ADyson i understood您能告诉我如何在我的控制器中捕获原始json以便推送到DB。这意味着@RequestBody参数中会有什么?