SnakeYAML is a YAML parser and emitter for the Java programming language.
Questions tagged [snakeyaml]
395 questions
0
votes
1 answer
yaml using SnakeYaml
---
university: scsb
country: us
Entities:
!Entity
name: john
subjects:
-math
-English
-C++
!Entity
name: mary
subjects:
-science
-French
I am trying to load the above file into a map, with data under entities…

learningtocode
- 755
- 2
- 13
- 27
0
votes
2 answers
What is a simple way of using snakeyaml to parse this file into an object?
Assume that I have a file that is of the following format that needs to be passed
Name: XYZ
SSN: 123
Name: ABC
SSN: 456
Assume I have created the following class
Class Data{
String name;
int ssn;
}
Now I need to parse the above file and for…

ExceptionHandler
- 213
- 1
- 8
- 24
0
votes
1 answer
snakeYaml refer to the same instance of an object multiple times
Inside of a list, I would like to refer to the same instance object multiple times:
- text: Here is an object with some data that will allow an image to be generated
image: &FirstIm
imageType: ABC
otherTypE: CB
- text: Later on, lets…

Sam
- 3,453
- 1
- 33
- 57
0
votes
1 answer
SnakeYAML class not found error?
I'm writing a small java program that needs to use SnakeYAML, and it works fine when running it from within Eclipse, but when I export it, it can't seem to locate the SnakeYAML class to handle the Yaml object, like in the Yaml yaml = new Yaml();…

user1570073
- 11
- 3
0
votes
1 answer
SnakeYAML : doesn't seem to work
I am following tutorial mentioned - http://code.google.com/p/snakeyaml/wiki/Documentation#Tutorial
My code looks like
public class Utilities {
private static final String YAML_PATH = "/problems/src/main/resources/input.yaml";
public…

daydreamer
- 87,243
- 191
- 450
- 722
0
votes
1 answer
How do I use snakeyaml as a function that returns something?
I am trying to make a function with snakeyaml that dumps an int, a string, and a string[]. The thing is I don't know how to write the function so that the info can be inserted.
For example:
public void testDump() {
Map data = new…

VinylScratch
- 123
- 9
-1
votes
2 answers
how to load a configuration from a .yaml file to a class in java?
I am using the snakeyaml library to load the yaml file but it shows me an error
this is the code from my Settings class, it has an Database object which represents the database settings
package com.example;
import java.io.FileInputStream;
import…

otaxhu
- 11
- 3
-1
votes
2 answers
Java uses snakeyaml read and write yaml
When I use snakeyaml to convert the yaml file into a class, the List object cannot be converted correctly.
The following can work
public class UserYaml {
private Integer test1;
private String test2;
private Test3 test3;
// private…

董梓轩
- 1
-1
votes
1 answer
Convert JSONObject to Yaml in JAVA 8
i am using jackson-dataformat-yaml-2.7.6 jar which is old version and cannot upgrade
trying to convert JSONObject to yaml
so below is my code
private static String processFilesForYml(JSONObject a_Obj) throws Exception
{
…

Dandy
- 467
- 1
- 10
- 33
-1
votes
1 answer
How to resolve SnakeYAML type dynamically
I have a YAML file defined as below:
policies:
- endpoint: /user/add
log: true
evaluator: consumer
data:
-
key: external
whitelist:
- name
-
key: internal
whitelist:
-…

yuexuan418
- 3
- 1
-1
votes
1 answer
Parse a yaml with placeholder in Java
I have a yaml file which consist of placeholders to be taken from environment variable. I want to parse it to a custom class. Currently I am using snakeyaml library to parse it and its populating the bean correctly, how can I resolve environment…

AlphaBetaGamma
- 1,910
- 16
- 21
-1
votes
1 answer
while parsing YML to POJO getting exception Invalid UTF-8 start byte 0x80 (at char #158, byte #-1)
I am trying to parse yml file into java object while parsing yml file with object mapper getting below exception.
Exception in thread "main"
com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException:
java.io.CharConversionException: Invalid…

prabjot singh
- 28
- 6
-1
votes
1 answer
yaml generation in Java
I am new to Java and I am having issue to generate a yaml. I want to generate a yaml file through java like below and I have used snake yaml for this purpose.
mart:
details:
name: Koushik
purpose: yaml generation for testing
owner:
…

Koushik Chandra
- 1,565
- 12
- 37
- 73
-1
votes
1 answer
Spring @ConfigurationProperties doesn't inject anything, field stays null
I am trying to inject values to fields like this:
@Component
@ConfigurationProperties("paypal")
public class Paypal
{
private List
- >> deleterequest;
public List
- >> getDeleterequest()
{
return…

Impulse The Fox
- 2,638
- 2
- 27
- 52
-1
votes
1 answer
YAML Read casts exception
I have an error while reading a file
Exception in thread "main" java.lang.ClassCastException: java.lang.String can not be cast to java.util.ArrayList.
Why does it not occur? I'm using YamlSnake lib
Person.java:
public class Person
{
int id;
…

Vlad Honya
- 160
- 3
- 13