# Home assistant call service node: invalid json syntaxerror unexpected token

**URL:** <https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938>\
**Category:** General\
**Created:** [23 December 2020 18:16 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938 "2020-12-23T18:16:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanwebber](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@stanwebber](https://discourse.nodered.org/u/stanwebber)\
**Post date:** [23 December 2020 18:16 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938/1 "2020-12-23T18:16:20Z")

</div>

i don't get what i'm doing wrong. i'm trying to use the call service node in home assistant to trigger:

domain: light  
service: turn\_on  
entity id: light.master\_bedroom  
data: "brightness\_pct": "100", "kelvin": "2700"

the json editor is complaining 'invalid json: syntaxerror: unexpected token : in json at position 16' in my data field. with the pages of light service data nomenclature that's plastered all over the call service node properties screen it would be nice if there was 1 syntax example.

---

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [23 December 2020 18:42 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938/2 "2020-12-23T18:42:43Z")

</div>

From what you posted, it does not look like valid json. You have a nested object "data".  
The object might look like this:

```auto
{
  domain: 'light',
  service: 'turn_on',
  'entity id': 'light.master_bedroom',
  data: {
    brightness_pct: 100,
    kelvin: 2700,
  },
}

```

With the corresponding json string:

```auto
{
   "domain":"light",
   "service":"turn_on",
   "entity id":"light.master_bedroom",
   "data":{
      "brightness_pct":100,
      "kelvin":2700
   }
}

```

---

<div class="post-metadata">

**Author:** ![stanwebber](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@stanwebber](https://discourse.nodered.org/u/stanwebber)\
**Post date:** [23 December 2020 19:03 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938/3 "2020-12-23T19:03:27Z")

</div>

what is the correct typed syntax for my data field? it is not:

"brightness\_pct": "100", "kelvin": "2700"

---

<div class="post-metadata">

**Author:** ![stanwebber](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@stanwebber](https://discourse.nodered.org/u/stanwebber)\
**Post date:** [25 December 2020 01:07 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938/4 "2020-12-25T01:07:52Z")

</div>

the correct syntax is:

{"brightness\_pct": "100", "kelvin": "2700"}

the properties dialog STRONGLY implies the {} is provided, but it is not.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 January 2021 01:07 UTC](https://discourse.nodered.org/t/home-assistant-call-service-node-invalid-json-syntaxerror-unexpected-token/37938/5 "2021-01-08T01:07:53Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
