diff --git a/json/json.go b/json/json.go index 220057d..9bb7e95 100644 --- a/json/json.go +++ b/json/json.go @@ -368,8 +368,8 @@ func writeJSONScalar(ctx *jsonWriteContext, node *yaml.Node) error { return nil case "!!bool": - // Booleans - ctx.write(node.Value) + // Booleans true/True/TRUE to true compatible with JSON + ctx.write(strings.ToLower(node.Value)) return nil case "!!null": diff --git a/json/json_test.go b/json/json_test.go index f189e1b..b6d1628 100644 --- a/json/json_test.go +++ b/json/json_test.go @@ -211,6 +211,20 @@ production: "host": "prod.example.com" } } +`, + indentation: 2, + }, + { + name: "booleans", + yamlInput: `lowerCaseBool: true +mixedCaseBool: True +upperCaseBool: FALSE +`, + expectedJSON: `{ + "lowerCaseBool": true, + "mixedCaseBool": true, + "upperCaseBool": false +} `, indentation: 2, },