在消息中发送类字段元数据

问题描述 投票:0回答:1

有没有人在

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
},

如有任何帮助,我们将不胜感激。

谢谢, 斯蒂芬

java json reflection jackson
1个回答
0
投票

检查您的设置代码

objectMapper.enableDefaultTyping(...)

达到某种价值...

© www.soinside.com 2019 - 2024. All rights reserved.