Packer with hetzner cloud builder


I am building the Image on the Hetzner cloud using packer and I am using the below format which is mentioned on the packer documentation page.

  "builders": [
      "type": "hcloud",
      "token": "c2dTt3dy0Ivrwl7418jZMA4AJbu9zOkb51Ct3J827Gmi61rx0MICvMYjFjO0gJeu",
      "image": "ubuntu-18.04",
      "location": "nbg1",
      "server_type": "cx21",
      "communicator": ssh,
      "ssh_username": "ubuntu"
  "provisioners": [
      "type": "shell",
      "inline": ["echo foo"]

When I do packer validate throws below error and I am not able to proceed. Please help.

root@tec:~/hetzner-cloud# packer validate images/image.pkr.hcl
Error: Argument or block definition required

  on images/image.pkr.hcl line 1:
   1: {

An argument or block definition is required here.

I am using packer 1.7.3 on Ubuntu 18.04 machine.

The problem has been solved by changing the JSON template to the HCL2 template.