[英]Is it possible to deserialize JSON to a tree in Java?
I have JSON response from Facebook, which I don't want to deserialize into a custom Java object. 我从Facebook,这是我不希望反序列化到一个自定义的Java对象的JSON响应。 Mostly because there is no guarantee that their API will stay stable.
主要是因为无法保证其API能够保持稳定。 Once they change it my deserialization will fail for sure.
一旦他们改变它,我的反序列化肯定会失败。
What I want is to deserialize their JSON data into HashMap<String, Object>
, where Object
may be a String
or a HashMap
. 我想要的是将他们的JSON数据反序列化为
HashMap<String, Object>
,其中Object
可以是String
或HashMap
。 In PHP it's called associative array and it is produced by json_decode()
function. 在PHP中,它被称为关联数组,它由
json_decode()
函数生成。 Is it possible to do the same in Java? 是否有可能在Java中做同样的事情?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.