Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play framework - how can I make play accept "null" values in yaml files?

I am trying to load data from a YAML file where some fields contain "null" values. Play Framework throws the following exception when it tries to parse a "null" value:

"play.exceptions.YAMLException: null; mapping values are not allowed here".

The following is a sample of the data I am trying to import:

person(0)
  name:F1
  father:

and the model:

    public class Person extends Model {

    public String name;

    public Long father;
}

You can see from the data sample that the "father" field has a "null" value. The father field is an "ID" to another person. How can I make Play accept it?

P.S: I have the "father" field as data type "Long" for technical reasons, so please don't advice me to make it a "Person" type.

like image 953
mohd874 Avatar asked Dec 31 '25 20:12

mohd874


1 Answers

Just leave it out of the yaml file. e.g this should work

person(0)
  name:F1
like image 189
Tommy Avatar answered Jan 03 '26 19:01

Tommy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!