作为一个一般的架构点,我通常建议不让依赖于特定的序列化格式渗出存储/网络层;因此,我首先建议您考虑测试自己的应用程序对象之间的平等,而不是他们的JSON表现。

说到这里,我现在是Jackson的大粉丝,我的快速阅读他们的ObjectNode.equals()实现建议你想要的集合成员资格比较:

public boolean equals(Object o)
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) {
return false;
ObjectNode other = (ObjectNode) o;
if (other.size() != size()) {
return false;
if (_children != null) {
for (Map.Entry en : _children.entrySet()) {
String key = en.getKey();
JsonNode value = en.getValue();
JsonNode otherValue = other.get(key);
if (otherValue == null || !otherValue.equals(value)) {
return false;
return true;