0

有没有人遇到过这个问题jackson JSON- 不知何故,JSON包括我班级的每个字段类型,以及我不感兴趣的其他元数据,因此发送的数据非常庞大!

例如,这是一个记录:

{
    "queue": "H",
    "internalStatus": "New",
    "id": "50030386",
    "screenDescription": "Test Case 1",

}
},
"fields": [
{
    "name": "id",
    "type": "java.lang.Integer",
    "modifiers": 2,
    "annotations": [

    ],
    "declaredAnnotations": [

    ],
    "declaringClass": "com.me.Charge",
    "synthetic": false,
    "genericType": "java.lang.Integer",
    "enumConstant": false,
    "accessible": false
},
{
    "name": "screenDescription",
    "type": "java.lang.String",
    "modifiers": 2,
    "annotations": [

    ],
    "declaredAnnotations": [

    ],
    "declaringClass": "com.me.Charge",
    "synthetic": false,
    "genericType": "java.lang.String",
    "enumConstant": false,
    "accessible": false
},
{
    "name": "internalStatus",
    "type": "java.lang.String",
    "modifiers": 2,
    "annotations": [

    ],
    "declaredAnnotations": [

    ],
    "declaringClass": "com.me.Charge",
    "synthetic": false,
    "genericType": "java.lang.String",
    "enumConstant": false,
    "accessible": false
},
{
    "name": "queue",
    "type": "java.lang.String",
    "modifiers": 2,
    "annotations": [

    ],
    "declaredAnnotations": [

    ],
    "declaringClass": "com.me.Charge",
    "synthetic": false,
    "genericType": "java.lang.String",
    "enumConstant": false,
    "accessible": false
},

任何帮助表示赞赏。

谢谢,斯蒂芬

4

1 回答 1

0

检查您的代码以进行设置

objectMapper.enableDefaultTyping(...)

以某种价值...

于 2012-11-27T11:42:00.713 回答