gpt4 book ai didi

Android 我可以使用 resttemplate 来序列化而不发送请求吗

转载 作者:行者123 更新时间:2023-11-30 03:09:31 30 4
gpt4 key购买 nike

我有一个来自 WebView 请求的 Json 字符串

为了保持一致性,我想使用 RestTemplate 将 httpstring 反序列化为对象

这可能吗?

最佳答案

RestTemplate 将始终发送请求,保持一致的最佳方式是使用 ObjectMapper示例代码:

public void convertJSONToProduct() throws Exception {
ObjectMapper m = new ObjectMapper();
Product product = m.readValue(jsonString, Product.class);

}

关于Android 我可以使用 resttemplate 来序列化而不发送请求吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21226458/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com