user3147268
user3147268

Reputation: 1884

Error with YAML deep nesting

I wanted to create a config file in YAML that stores a few translations. To encapsulate everything, I began to nest the options.

While parsing the file, I see the following error:

Failed to read data from customize.yaml\customize.yaml: yaml: line 30: mapping values are not allow

ed in this context

The parser refers to the following lines:

contact:
  title: Contact
  form:
    name: Name
      error: Please enter your name.
    email: Email
      error: Please enter your email address.
    phone: Phone
      error: Please enter your phone number.
    message: Message
      error: Please enter a message.
    send: Send

Upvotes: 0

Views: 320

Answers (1)

Anthon
Anthon

Reputation: 76598

If you want the value as well as the error messages to "belong" to the key, you need to make a list of two items

name:
- Name
- error: Please enter your name.

or as another mapping with two items:

name:
  value: Name
  error: Please enter your name.

Upvotes: 1

Related Questions