如何防止杰克逊在某些json属性上生成pojos

时间:2016-09-03 09:29:17

标签: java json jackson

我是一个奇特的杰森。在下面的json文件中,我不想为j10&生成pojos。 j11属性,但j10j11内的属性可以包含pojos。

这可以通过jackson api实现吗?

我想跳过产生pojos的唯一原因是我最终会创造30种没有任何意义的pojos。

Json文件:

{
            "jh": [
                {"j10": {
                    "components": [
                        {
                            "name": "InventoryManager",
                            "url": "/atg/commerce/inventory/InventoryManager",
                            "properties": [
                                {
                                    "name": "maxConcurrentUpdateRetries",
                                    "value": "0",
                                    "exclusions": "true"
                                }
                            ]
                        },
                        {
                            "name": "CatalogTools",
                            "url": "/atg/commerce/catalog/CatalogTools/",
                            "properties": [
                                {
                                    "name": "queryASAFFabrics",
                                    "value": "skuType=\"ASAF_FABRIC\" AND NOT basicColor IS NULL ORDER BY dynamicAttributes.fabricpriceband, basicColor, dynamicAttributes.fabrictype, dynamicAttributes.asafpattern, dynamicAttributes.asaffabricbrand",
                                    "exclusions": "false"
                                },
                                {
                                    "name": "loggingDebug",
                                    "value": "true",
                                    "exclusions": "false"
                                }
                            ]
                        }
                    ],
                    "bots": "true"
                }
            },
                {
                "j11": {
                    "components": [
                        {
                            "name": "InventoryManager",
                            "url": "/atg/commerce/inventory/InventoryManager",
                            "properties": [
                                {
                                    "name": "maxConcurrentUpdateRetries",
                                    "value": "1",
                                    "exclusions": "false"
                                }
                            ]
                        },
                        {
                            "name": "CatalogTools",
                            "url": "/atg/commerce/catalog/CatalogTools/",
                            "properties": [
                                {
                                    "name": "queryASAFFabrics",
                                    "value": "skuType=\"ASAF_FABRIC\" AND NOT basicColor IS NULL ORDER BY dynamicAttributes.fabricpriceband, basicColor, dynamicAttributes.fabrictype, dynamicAttributes.asafpattern, dynamicAttributes.asaffabricbrand",
                                    "exclusions": "false"
                                },
                                {
                                    "name": "loggingDebug",
                                    "value": "true",
                                    "exclusions": "false"
                                }
                            ]
                        }
                    ],
                    "bots": "false"
                }
            }
            ]}

如果问题需要改进,请告诉我。

提前致谢。

0 个答案:

没有答案