# Webhooks with decimal data

**URL:** <https://community.particle.io/t/webhooks-with-decimal-data/16574>\
**Category:** Troubleshooting\
**Created:** [October 15, 2015, 12:42pm UTC](https://community.particle.io/t/webhooks-with-decimal-data/16574 "2015-10-15T12:42:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhdevx](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mhdevx/32/7047_2.png) [@mhdevx](https://community.particle.io/u/mhdevx)\
**Post date:** [October 15, 2015, 12:42pm UTC](https://community.particle.io/t/webhooks-with-decimal-data/16574/1 "2015-10-15T12:42:51Z")

</div>

Hi,

I created a Webhook to post data to [parse.com](http://parse.com). That works well except for one tiny detail: decimal numbers are converted to Strings. Is there a way to preserve the double or int type?

My event looks like the this:

```
{"name":"sensor","data":"{\"status\": 0, \"temp\": 10.46, \"pressure\": 1001.26, \"humidity\": 75.91, \"soil1\": 3290, \"soil2\": 3268, \"soil3\": 3294}","ttl":"60","published_at":"2015-10-15T12:35:08.693Z","coreid":"25002c000447343339373536"}

```

All the relevant data types of the JSON object are decimals, like status, temp, etc.  
The following Webhook is configured to post that data to [parse.com](http://parse.com):

```
{
    "eventName": "sensor",
    "deviceid": "25002c000447343339373536",
    "url": "https://api.parse.com/1/classes/Status",
    "requestType": "POST",
    "headers": {
        "X-Parse-Application-Id": "12345678",
        "X-Parse-REST-API-Key": "12345678",
        "Content-Type": "application/json"
    },
    "json": {
        "status": "{{status}}",
        "temperature": "{{temp}}",
        "pressure": "{{pressure}}",
        "humidity": "{{humidity}}",
        "soil1": "{{soil1}}",
        "soil2": "{{soil2}}",
        "soil3": "{{soil3}}",
        "coreid": "{{SPARK_CORE_ID}}"
    },
    "mydevices": true,
    "noDefaults": true
}

```

Technically that working well, I can see the data on the [parse.com](http://parse.com) dashboard. My only problem are the quotes, for the JSON data send, like:

```
"status": "{{status}}"

```

This results in status stored as string at [parse.com](http://parse.com) but I would like to store it as decimal.

```
"status": {{status}}

```

This (without the quotes) does not work. Creating the Webhook fails with the following error:

> tryParse error [SyntaxError: Unexpected token {]  
> Please check your .json file for syntax error.

Any idea how this can be solved?

Thx  
Markus

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [October 15, 2015, 4:35pm UTC](https://community.particle.io/t/webhooks-with-decimal-data/16574/2 "2015-10-15T16:35:22Z")

</div>

This is not possible yet. The Particle cloud software will need to change to make this possible. @Dave has this on his radar.

See these 2 threads for the discussion.

> **[Webhooks with JSON arrays or nested objects escaping quotes](http://community.particle.io/t/webhooks-with-json-arrays-or-nested-objects-escaping-quotes/15614)**
>
> Hey @Dave! Is there any reason why a webhook with the following format wouldn't work? "json": { "myarray": "{{somedata}}" }, Where somedata is published to the webhook as an array with the following format \[{"id":"1234","status":"SOMESTATE"}\]. ...

> **[{{SPARK\_EVENT\_VALUE}} gets HTML encoded](http://community.particle.io/t/spark-event-value-gets-html-encoded/12299)**
>
> When creating a custom webhook endpoint, the value {{SPARK\_EVENT\_VALUE}} gets HTML encoded so the endpoint receives " instead of proper quotation marks, making JSON decoding fail. I created a webhook with this format: { "eventName":...

---

<div class="post-metadata">

**Author:** ![mhdevx](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mhdevx/32/7047_2.png) [@mhdevx](https://community.particle.io/u/mhdevx)\
**Post date:** [October 15, 2015, 5:03pm UTC](https://community.particle.io/t/webhooks-with-decimal-data/16574/3 "2015-10-15T17:03:38Z")

</div>

Thx @jvanier. I will then use Strings for a will and try to convert them on the [parse.com](http://parse.com) side.
