[Solved]: How To Split A String Into Multiple Lines In YAML?

1. Block Notation(plain, flow-style, scalar): Newlines become spaces and extra newlines after the block are removed

---# Note: It has 1 new line after the stringcontent:    Arbitrary free text    over multiple lines stopping    after indentation changes......

Equivalent JSON

{ "content": "Arbitrary free text over multiple lines stopping after indentation changes..."}

2. Literal Block Scalar: A Literal Block Scalar | will include the newlines and any trailing spaces. but removes extra

newlines after the block.

---# After string we have 2 spaces and 2 new linescontent1: | Arbitrary free text over "multiple lines" stopping after indentation changes...  ...

Equivalent JSON

{ "content1": "Arbitrary free textnover "multiple lines" stoppingnafter indentation changes...  n"}

3. + indicator with Literal Block Scalar: keep extra newlines after block

---# After string we have 2 new linesplain: |+ This unquoted scalar spans many lines....

Equivalent JSON

{ "plain": "This unquoted scalarnspans many lines.nnn"}

4. – indicator with Literal Block Scalar:  means that the newline at the end of the string is removed.

---# After string we have 2 new linesplain: |- This unquoted scalar spans many lines....

Equivalent JSON

{ "plain": "This unquoted scalarnspans many lines."}

5. Folded Block Scalar(>):

will fold newlines to spaces and but removes extra newlines after the block.

---folded_newlines: > this is really a single line of text despite appearances...

Equivalent JSON

{ "fold_newlines": "this is really a single line of text despite appearancesn"}