首页 \ 问答 \ 使用Jackson数据绑定跳过嵌套字段?(Skipping nested field with Jackson data binding?)

使用Jackson数据绑定跳过嵌套字段?(Skipping nested field with Jackson data binding?)

我如何使用Jackson将以下json片段绑定(双向)到下面的Java对象?

我希望Json新闻稿节点的键/值对最终位于新闻稿字段的Map中。 什么必须是杰克逊配置(注释和其他)绑定这个? 对不起,我不知道如何:((使用最新版本的杰克逊)。

下面的Json格式是固定的,我从第三方休息服务(我无法更改)接收它。 我可以更改java代码,但更喜欢下面的设置。

JSON:

{
    "newsletter": {
        "key1": "value1",
        "key2": "value2",
        "key3": "value3"
    }
}

Java对象:

class Preferences {
    private NewsLetter newsLetter;
    // getter/setter for field newsLetter.
}

class NewsLettter {
    private Map<String, String> properties;
    // getter/setter for field properties.
}

How must I bind (bidirectional) the following json snippet to the Java objects below with Jackson?

I want the key/value pairs of the Json newsletter node to end up in the Map of the newsletter field. What must be the Jackson config (annotations and others) to bind this ? Sorry, I don't know how :( (using the latest version of Jackson).

The Json format below is fixed, I receive it from a third party rest service (I can't change it). I can change the java code, but prefer the setup below.

JSON:

{
    "newsletter": {
        "key1": "value1",
        "key2": "value2",
        "key3": "value3"
    }
}

The Java Objects:

class Preferences {
    private NewsLetter newsLetter;
    // getter/setter for field newsLetter.
}

class NewsLettter {
    private Map<String, String> properties;
    // getter/setter for field properties.
}

原文:https://stackoverflow.com/questions/31752242
更新时间:2024-02-04 22:02

最满意答案

TABLET一次不支持多个BAM文件(至少暂时)。 因此可以使用其他可视化器,例如IGVSAVANT ,它支持多个BAM可视化


TABLET doesn't support more than one BAM File at a time (For time being at least). So can go with other visualizers such as IGV, SAVANT which supports more than one BAM visualization

相关问答

更多
  • 通过将属性Text Alignment设置为Center来解决该问题。 似乎默认情况下由“Center:Inherited”设置,所以这里是正确解决方案的步骤: 将属性Text Alignment设置为另一个值(Ex:Justify) 保存报告 再次使用正确的值“Center”设置属性Text Alignment 保存报告 只有遵循这些步骤才能正确设置属性。 The problem was solved by setting the property Text Alignment to Center. It ...
  • 你必须安装Android版本的Adobe Flash,但由于Adobe不再支持Android平台,我强烈建议你用你的Android应用程序中的HTML5 + Javascript或Java代码替换你的swf 。 You have to install the Android version of Adobe Flash, but since Adobe no longer supports the Android platform, I'd strongly suggest you replace your ...
  • 两天后,我终于解决了这个问题。 我注意pcl :: visualization :: PCLVisualizer的构造函数以及“SpinOnce”函数,我认识到如果你放一个静态锁,这样只有多个对象中的一个线程可以访问这些函数,那么问题就解决了。 以前,我在这些函数上放置了非静态锁,正如您所知,本地锁只在它们创建的同一对象中工作(不是从类中实例化的整个对象)。 所以我在my_vis类中定义了一个静态锁: private static boost::mutex vis_mutex; boost ...
  • 这是一个Sankey图,边缘的宽度与节点之间传输的量成比例。 https://en.wikipedia.org/wiki/Sankey_diagram 关于SO的答案表明rCharts可用于创建此类图。 It's a Sankey Diagram, where the width of the edges is proportional to the amount transferred between nodes. https://en.wikipedia.org/wiki/Sankey_diagram ...
  • Jenya Kirmiza, 大小类是你想要的:)大小类是在iOS8中引入的,以避免通用应用程序的多个故事板,并为开发人员提供了一种简单的方法来为不同的设备设计不同的UI :) 我希望你知道SizeClasses,如果你不知道每个设备的各种方向都属于Apple定义的sizeClass之一。 这里需要注意的一点是iPad的两个方向都属于Regular x Regular size class 除iphone 6S和iphone 6s +之外的所有iPhone都将落到 Copact Width x Regula ...
  • 根据User-Agent标头的值,CloudFront会在将请求转发到您的源之前将这些标头的值设置为true或false。 如果某个设备属于多个类别,则可能有多个值。 例如,对于某些平板电脑设备,CloudFront可能会将CloudFront-Is-Mobile-Viewer和CloudFront-Is-Tablet-Viewer设置为true。 (重点补充) http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header- ...
  • 感谢dart:js你可以使用任何js lib。 有关详细信息,请参阅使用Dart中的JavaScript 。 Thanks to dart:js you can use any js lib. See Using JavaScript from Dart for more details.
  • TABLET一次不支持多个BAM文件(至少暂时)。 因此可以使用其他可视化器,例如IGV , SAVANT ,它支持多个BAM可视化 TABLET doesn't support more than one BAM File at a time (For time being at least). So can go with other visualizers such as IGV, SAVANT which supports more than one BAM visualization
  • 灵感来自https://stackoverflow.com/a/5808864/2339680我想问题是,vtkRenderWindow仅作为前向声明可用于编译器。 如果你包括 #include "vtkRenderWindow.h" 在一开始,一切都应该编译。 With inspiration from https://stackoverflow.com/a/5808864/2339680 i guess that the problem is, that vtkRenderWindow is only ...
  • 刚发现他们有更新...... 看来,当我们推出新版本时,系统会出现一些小问题,直到更改完全传播为止。 我们将来会努力解决这个问题,但是现在,如果你遇到这些错误,我建议你刷新页面,如有必要,刷新你的缓存。 您还可以将“当前”更改为“43”或“44”,它将更可靠地工作。 将其更改为44 google.charts.load('44',为我工作! 感谢https://stackoverflow.com/a/35661581/1700554 Just found out they had an update... ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)