# Converting JSON input for use in the Filemaker Server API

**URL:** <https://discourse.nodered.org/t/converting-json-input-for-use-in-the-filemaker-server-api/70473>\
**Category:** General\
**Created:** [11 November 2022 22:43 UTC](https://discourse.nodered.org/t/converting-json-input-for-use-in-the-filemaker-server-api/70473 "2022-11-11T22:43:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deninger](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@deninger](https://discourse.nodered.org/u/deninger)\
**Post date:** [11 November 2022 22:43 UTC](https://discourse.nodered.org/t/converting-json-input-for-use-in-the-filemaker-server-api/70473/1 "2022-11-11T22:43:06Z")

</div>

I have set up a node to receive api data from a system. It comes in JSON format:

```auto
{
   "ID": "1234567890",
   "Event":"Test Node-Red",
   "Context":"1234567-00"
}

```

When it appears in Node-Red, it shows up as a string with quotes

"{"ID":"1234567890","Event":"Test Node-Red","Context":"1234567-00"}"

I want to convert this data to the following format:

```auto
{ "fieldData" : 
   {
     "ID":"1234567890",
     "Event":"Test Node-Red",
     "Context":"1234567-00"
   }
}

```

I thought this might be as easy as using a Change Function and using a JSONata formula to change msg.payload using {"fieldData": msg.payload }

The transformation "works" but because of the quotes that were added when the data came in from the POST it doesn't work. I get:

![Screen Shot 2022-11-11 at 4.39.25 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4cbcbef84ca90e90736239ca36b74e92d02d9c0.png)  
(The screenshot references NPI instead of ID. That is because the screenshot was taken before I updated my naming)  
object  
fieldData: "  
{"ID":"1234567890","Event":"Test Node-Red","Context":"1234567-00"}"

Which has the extra quotes and therefore won't work with Filemaker's API

Can someone point out a better way to do this please?

Thanks!

Mike

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 November 2022 23:41 UTC](https://discourse.nodered.org/t/converting-json-input-for-use-in-the-filemaker-server-api/70473/2 "2022-11-11T23:41:11Z")

</div>

Your incoming payload from the api is a JSON string, pass it through a Json node to convert is to an object.  
e.g.

```auto
[{"id":"54b1c8d10ae639fc","type":"inject","z":"452103ea51141731","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ID\": \"1234567890\", \"Event\":\"Test Node-Red\", \"Context\":\"1234567-00\" }","payloadType":"str","x":110,"y":3700,"wires":[["4644d424090c392c"]]},{"id":"4644d424090c392c","type":"json","z":"452103ea51141731","name":"","property":"payload","action":"","pretty":false,"x":270,"y":3700,"wires":[["6e59adc03805c729"]]},{"id":"6e59adc03805c729","type":"change","z":"452103ea51141731","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.fieldData","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":3700,"wires":[["74e78bcb11dda281"]]},{"id":"74e78bcb11dda281","type":"debug","z":"452103ea51141731","name":"debug 107","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":3680,"wires":[]}]

```

---

<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:** [25 November 2022 23:41 UTC](https://discourse.nodered.org/t/converting-json-input-for-use-in-the-filemaker-server-api/70473/3 "2022-11-25T23:41:34Z")

</div>

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