To Number
Converts strings to numbers
- "3"
- "3.1"
- "-1e3"yq '.[] | to_number' sample.yml3
3.1
-1e3Doesn't change numbers
- 3
- 3.1
- -1e3Cannot convert null
Last updated
- "3"
- "3.1"
- "-1e3"yq '.[] | to_number' sample.yml3
3.1
-1e3- 3
- 3.1
- -1e3Last updated
yq '.[] | to_number' sample.yml3
3.1
-1e3yq --null-input '.a.b | to_number'Error: cannot convert node value [null] at path a.b of tag !!null to number