用外部变量解析yaml文件
我正在尝试使用杰克逊(Jackson)从一个巨大的yaml文件中获取一些值,并将其读成树以获取所需的路径。
ObjectMapper om = new ObjectMapper(new YAMLFactory())
om.readTree(file).path("connections").path("connection")
它无法在以下行中解析文件:
config.file.path: {{DIR}}/config/
com.fasterxml.jackson.core.jsonparseexception:期望一个字段名称 (YAML中的标量值),而是这样做: < org.yaml.snakeyaml.events.mappingstartevent(Anchor = null,tag = null, 隐式= true)>在[源:(StringReader);线:80,列:18]
由于我不需要这条线,是否有办法告诉解析器跳过/忽略它?
I am trying to get some values out of a huge YAML file using Jackson and read as a tree to get the path I need.
ObjectMapper om = new ObjectMapper(new YAMLFactory())
om.readTree(file).path("connections").path("connection")
It fails to parse the file on the following line:
config.file.path: {{DIR}}/config/
com.fasterxml.jackson.core.JsonParseException: Expected a field name
(Scalar value in YAML), got this instead:
<org.yaml.snakeyaml.events.MappingStartEvent(anchor=null, tag=null,
implicit=true)> at [Source: (StringReader); line: 80, column: 18]
As I don't need this line, is there a way to tell the parser to skip/ignore it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论