Need help formating automation action

I am trying to sent an HTML 5 push notification from a service template but I am unsure if I need to use JSON formatting or regular formatting. I have included two examples below can someone please guide me in the right direction or tell me which is correct? Thank you for all your help.

  - alias: Is XXX on XBOX
trigger:
 - platform: state
   entity_id: sensor.[XBOXSENSORNAME]
action:
  - service_template: >-
      {% if trigger.to_state.state == "Online" and trigger.from_state.state == "Offline" %}
          notify.google_push
            data_template:
              message: "XXX has signed on to XBox"
              target: ["TARGET1", "TARGET2"]
              data:
                tag: 'XXX Signed on to Xbox'
      {% elif trigger.to_state.state == "Offline" and trigger.from_state.state == "Online" %}
          notify.google_push
            data_template:
              message: "Lexi has signed off of XBox"
              target: ["TARGET1", "TARGET2"]
              data:
                tag: 'XXX Signed off of Xbox'
      {% endif %}

  - alias: Is XXX on XBOX
trigger:
 - platform: state
   entity_id: sensor.[XBOXSENSORNAME]
action:
  - service_template: >-
      {% if trigger.to_state.state == "Online" and trigger.from_state.state == "Offline" %}
          notify.google_push
            {
              "title": "xxx has signed on to XBOX",
              "message": "xxx has signed on to XBOX",
              "data": {
                "tag": "xxx has signed onto XBOX"
               }
             }
      {% elif trigger.to_state.state == "Offline" and trigger.from_state.state == "Online" %}
          notify.google_push
            {
              "title": "XXX has signed off of XBOX",
              "message": "XXX has signed off of XBOX",
              "data": {
                "tag": "XXX has signed off of XBOX"
               }
             }
      {% endif %}