It’s sometimes handy (e.g, in test suites) to have a JSON string hardcoded. If you want to interpolate it to insert a variable, use $$, like this:
var ratingUnitNumber = "test"; var cloudEvent = $$""" { "id": "5565db35-01a9-4596-b611-9b26d2210c6e", "source": "https://s4h-dev.blah.govt.nz", "type": "nz.govt.blah.s4.ratingunitchanged", "subject": "blah", "data": { "ratingUnits": [ { "ratingUnitNumber": "{{ratingUnitNumber}}" }] }, "time": "2024-03-11T23:09:27.5683052+00:00", "specversion": "1.0" } """;
Hopefully that helps someone.