无法从文件中读取负载

问题描述

我正在尝试从 jsonfile 插入有效负载,但收到一个错误的请求并且无法从文件中读取日期,不确定我做错了什么

workerType

解决方法

使用jackson objectMapper objectMapper.writeValue(new File(".\JSONFileinput\file.json"),jsonBody); 或 writeValueAsString

,

将 json 读取为字符串并将其传递给您的身体:

String payload = Files.readString(".\\JSONFileinput\\file.json",StandardCharsets.US_ASCII);