# Error from Webhook - Unexpected Token

**URL:** <https://forums.losant.com/t/error-from-webhook-unexpected-token/147>\
**Category:** Help\
**Created:** [May 5, 2016, 5:37pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147 "2016-05-05T17:37:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 5:37pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/1 "2016-05-05T17:37:52Z")

</div>

I am just started a new project to measure solar insolation based on the climate monitor by Bruan Krohn on hackster.io.using a Particle Photon.

It is gathering data but I get nothing past the Webhook. Adding a debug block there shows:

{ uri: ‘/v1/webhooks’,  
method: ‘POST’,  
json:  
{ event: ‘insolation’,  
url: ‘[https://triggers.losant.com/webhooks/deleted](https://triggers.losant.com/webhooks/deleted)’,  
deviceid: undefined,  
requestType: ‘POST’,  
mydevices: true,  
json: { value1: ‘{{l}}’ } },  
headers: { Authorization: ‘Bearer deleted’ }  
}

I cannot find any unpaired ‘}’. Anyone have any ideas?

David

---

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 5:40pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/2 "2016-05-05T17:40:56Z")

</div>

Opps, the error did not post up there, it is:

Error  
Unexpected token }

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [May 5, 2016, 5:53pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/3 "2016-05-05T17:53:41Z")

</div>

> [@David\_V\_Gibson](#):
>
> { value1: ‘{{l}}’ } }

Looks like there’s an extra } in there?

---

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 6:04pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/4 "2016-05-05T18:04:03Z")

</div>

I see that, but the code to create the webhook looks balanced:

{  
“event”: “insolation”,  
“url”: “[https://triggers.losant.com/webhooks/deleted](https://triggers.losant.com/webhooks/deleted)”,  
“requestType”: “POST”,  
“json”: {“value1”: “{{l}}” },  
“mydevices”: true  
}

So where is that extra one coming from?

---

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 6:05pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/5 "2016-05-05T18:05:35Z")

</div>

I create it with:

particle webhook create structure-webhook.json

---

<div class="post-metadata">

**Author:** ![Brandon\_Cannaday](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/brandon_cannaday/32/14_2.png) [@Brandon\_Cannaday](https://forums.losant.com/u/Brandon_Cannaday)\
**Post date:** [May 5, 2016, 7:32pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/6 "2016-05-05T19:32:33Z")

</div>

I jumped into your workflow to take a closer look. The error is caused by the data field coming from Particle:

```auto
"data": "{ \"l\": 2686.0, }"

```

There’s an extra comma after `2686.0`, which makes this invalid JSON. The error you’re getting in the workflow is coming from the function node trying to JSON.parse this string.

---

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 8:07pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/7 "2016-05-05T20:07:56Z")

</div>

Good catch! Thanks. I corrected that and now there are no errors, but still nothing in the device log. Funny, it says not connected but in the debug I see the data. So maybe its still not Json enough? Also tried a time series graph but nothing there, and would not expected it if it is not logging data.

---

<div class="post-metadata">

**Author:** ![David\_V\_Gibson](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@David\_V\_Gibson](https://forums.losant.com/u/David_V_Gibson)\
**Post date:** [May 5, 2016, 8:21pm UTC](https://forums.losant.com/t/error-from-webhook-unexpected-token/147/8 "2016-05-05T20:21:52Z")

</div>

Found it! another glitch in the tutorial not matching the current code. Now its graphing!
