Friday, May 28, 2021

Full YAML Tutorial - Nested Array - Nested JSON

https://codebeautify.org/yaml-to-json-xml-csv/cb162ac2?restoreDataAfter=true       [VImp]

https://www.cloudbees.com/blog/yaml-tutorial-everything-you-need-get-started/

https://www.json2yaml.com/


Array, List, Map, Scalar, Boolean , Number
Quotes are optional
It automatically converts Data type to Boolean, String
List has dash followed by space


--- 3 Dash means separate YAML Document
Multiline with Formatting Preserved -    Use    Pipe    |
Multiline with Formatting Ignored -    Use   Redirection Operator  >


Chomp Modifiers

Multiline values may end with whitespace, and depending on how you want the document to be processed you might not want to preserve it. YAML has the strip chomp and preserve chomp operators. To save the last character, add a plus to the fold or block operators.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
friends:
    - Karan
    - Sahil
    - Ashish
    - Rahul
    - GodGoddess:
        Brahma: Saraswati
        Vishnu: Lakshmi
        Mahesh: Parvati
school: Model Academy
place: Jammu
VitalStats:
    Length: 5 Foot
    Attributes:
        - Black Complexion
        - Tall
        - curly Hair
        - Intelligence:
            IQ: 150
            EQ: 100
        - Hobbies: [Hollywood, "Pranks", "Comics"]
LongStringNoFormatting: |
    All right!
    Okay!
    Fine!
LongStringPreseveFormatting: >
    All right!
    Okay!
    Fine!
{
  "array": [
    {
      "description": "work"
    },
    "Hola",
    123,
    [
      "karan",
      "sumit"
    ],
    {
      "description": "work",
      "URL": "https://www.digitalocean.com/"
    },
    [
      {
        "description": "work",
        "URL": "https://www.digitalocean.com/"
      }
    ],
    [
      {
        "desciption": "tutorials"
      },
      {
        "URL": "www.digitalocean.com"
      }
    ]
  ]
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
---
array:
- description: work
- Hola
- 123
- - karan
  - sumit
- description: work
  URL: https://www.digitalocean.com/
- - description: work
    URL: https://www.digitalocean.com/
- - desciption: tutorials
  - URL: www.digitalocean.com

No comments:

Post a Comment

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass