MOXy支持泽西岛的JSON Pointer(RFC6901)

时间:2015-11-12 14:26:12

标签: java json jersey moxy

我试图按照RFC6901又称JSON指针的规范,在Jersey中使用MOXy将递归bean编组为JSON。

例如,我想整理这个:

   public class Bean {
     public Integer id;
     public String name;
     public Bean other;
     public List<Bean> next;
   }

   x = new Bean(123, "X");
   a = new Bean(456, "A");
   x.other = a;
   x.next.add(x);
   x.next.add(a);

进入这个:

   {
     "id": 123,
     "name": "X",
     "a": { "id": 456, "name": "A", "next": [ ] },
     "next": [
       { "$ref": "#" },
       { "$ref": "#/a" }
     ]
  }

然后将此JSON解组到原始bean。有人对此问题有任何建议/解决方案吗?

0 个答案:

没有答案