Questions tagged [snakeyaml]

SnakeYAML is a YAML parser and emitter for the Java programming language.

312 questions
40
votes
2 answers

How to define a map in a YAML file for simple POJO?

I am using snakeYaml to parse certain configuration/property values to a Configuration object. My yaml file looks like this - #Thread batchLimit: 1000 threadCountLimit: 2 #Some More Config key: value #MAP keyMapping: My…
frugalcoder
  • 831
  • 1
  • 8
  • 22
23
votes
4 answers

Spring Boot: read list from yaml using @Value or @ConfigurationProperties

I want to read a list of hosts from a yaml file (application.yml), the file looks like this: cors: hosts: allow: - http://foo1/ - http://foo2/ - http://foo3/ (Example 1) My class used defines the…
Marged
  • 9,123
  • 9
  • 45
  • 87
20
votes
3 answers

gpg: Sorry, no terminal at all requested - can't get input

When decrypting I get following error: $ eyaml decrypt -s 'ENC and the key goes on here' .gnupg --quiet --no-secmem-warning --no-permission-warning --no-tty --yes --decrypt) failed with: gpg: Sorry, no terminal at all requested - can't get input I…
15
votes
1 answer

Ignore fields from yaml when parsing it using SnakeYaml (Unable to find property on class)

I am using SnakeYaml to parse yaml file, is there anyway to ignore properities from the yaml file ?
Bilal Halayqa
  • 802
  • 6
  • 20
13
votes
3 answers

How do I write to a YAML file using SnakeYaml?

Consider the following code: public static void dumpObjectToYaml(String key, Object O, String path) throws IOException { Map data = new HashMap<>(); data.put(key, O); File F = new File(path); F.mkdirs(); …
Jonas Bartkowski
  • 327
  • 1
  • 5
  • 15
12
votes
1 answer

Include YAML files from snakeyaml

I would like to have YAML files with an include, similar to this question, but with Snakeyaml: How can I include an YAML file inside another? For example: %YAML 1.2 --- !include "load.yml" !include "load2.yml" I am having a lot of trouble with it.…
Blazes
  • 4,405
  • 2
  • 19
  • 28
11
votes
1 answer

Spring Boot YAML configuration with URL in key no longer loads correctly with version 2

I'm migrating my application from Spring Boot 1.5 to 2.0 and one of the YAML properties no longer loads correctly. The following configuration snippet: myapp serviceUrls: 'https://example.org/test': 'https://test.example.org/Endpoint' is…
Kolargol00
  • 1,361
  • 1
  • 12
  • 20
11
votes
2 answers

How to parse part of a YAML file in SnakeYaml

I am new to YAML and have parse a YAML config file that looks like: applications: authentication: service-version: 2.0 service-url: https://myapp.corp/auth app-env: DEV timeout-in-ms: 5000 enable-log: true service1: …
Niranjan
  • 2,082
  • 5
  • 31
  • 48
10
votes
3 answers

Parsing a YAML document with a map at the root using snakeYaml

I want to read a YAML document to a map of custom objects (instead of maps, which snakeYaml does by default). So this: 19: typeID: 2 limit: 300 20: typeID: 8 limit: 100 Would be loaded to a map which looks like this: Map
Justas
  • 752
  • 1
  • 9
  • 21
9
votes
1 answer

snakeyaml and spark results in an inability to construct objects

The following code executes fine in a scala shell given snakeyaml version 1.17 import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.Constructor import scala.collection.mutable.ListBuffer import scala.beans.BeanProperty class…
placeybordeaux
  • 1,928
  • 1
  • 16
  • 35
8
votes
2 answers

Spring Profile include issue with yaml file

I'm trying to accomplish when the team sets the websphere profile active that the cloud profile is also activated. yaml file --- spring: application: name: kicapp output: ansi: enabled: ALWAYS …
ndrone
  • 3,114
  • 1
  • 18
  • 33
8
votes
2 answers

Java SnakeYaml - prevent dumping reference names

I have the following method which I use to get the object converted to yaml representation (which I can eg. print to console) @Nonnull private String outputObject(@Nonnull final ObjectToPrint packageSchedule) { DumperOptions options = new…
Kris
  • 5,465
  • 2
  • 25
  • 45
7
votes
2 answers

How to resolve snakeyaml NoSuchMethodError: getStyle()

In my spring boot application, I am using snakeyaml to parse a YAML file. I get the following error though when using the library: java.lang.NoSuchMethodError: org.yaml.snakeyaml.nodes.ScalarNode.getStyle()Ljava/lang/Character; I am using the…
user2035039
  • 891
  • 10
  • 30
7
votes
1 answer

Filter out null fields in snakeyaml

I am using snakeyaml to print my object in a YAML file. There are some fields which could be null. How can I prevent these field, when they are null from being printed in the file?
warrior107
  • 539
  • 1
  • 7
  • 23
7
votes
1 answer

Polymorphic collections in SnakeYaml

My intention is to have polymorphic collections like the ones in JSON using jackson, maybe with the help of tags. I can't seem to able to configure it properly tho. My yaml file is: !person age: 27 job: dev name: me skills: - !devSkill { …
MLProgrammer-CiM
  • 16,915
  • 5
  • 39
  • 75
1
2 3
20 21