2012-11-27 31 views
0

元數據有沒有人碰到這個問題jackson JSON - 莫名其妙的JSON是包括我的每一個類的字段類型,和其他元數據的我不感興趣,並且被髮送這樣的數據是巨大!發送類字段在消息

E.g.這是一條記錄:

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

任何幫助表示讚賞。

感謝, 斯蒂芬

+0

我們可以看到你想要連載類? –

+0

多態類型的這種正常行爲。如果你可以包括你用什麼版本的傑克遜,我們可以告訴你如何擺脫它 –

回答

0

檢查你的代碼,用於設置

objectMapper.enableDefaultTyping(...) 

一些價值...