# Change "." for "," inside JSON

**URL:** <https://community.n8n.io/t/change-for-inside-json/8508>\
**Category:** Questions\
**Tags:** data-transformation\
**Created:** [October 15, 2021, 8:31pm UTC](https://community.n8n.io/t/change-for-inside-json/8508 "2021-10-15T20:31:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleix\_Iglesias](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/aleix_iglesias/32/2882_2.png) [@Aleix\_Iglesias](https://community.n8n.io/u/Aleix_Iglesias)\
**Post date:** [October 15, 2021, 8:31pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/1 "2021-10-15T20:31:05Z")

</div>

Hi friends, I have a really big Spreadsheet with GSheets and it’d be a pain in the but to change the decimal format of the document.

I’d like to change the json from my Shopify Webhook, so I can translate 5.00 to \> 5,00. It’d make my life way much easier!

Thank you!

---

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [October 15, 2021, 10:27pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/2 "2021-10-15T22:27:27Z")

</div>

Hi @Aleix_Iglesias

This is an example of how you can do that.

Please edit these value. (Since I’m replying from mobile it’s hard for me to type)

From Shopify trigger drag the arrow & create a new function node then Open it.

 ![Screenshot_20211016-035359~2](https://europe1.discourse-cdn.com/n8n/original/2X/8/85bed9521f96bd5f50bf790b51b0182f72e50568.png)

Now paste this code.

Make sure to edit the 3rd line path according to yours. (Replace: $node[“Set”].json[“Value”] with the item path from the Shopify trigger)

```auto
// Code here will run only once, no matter how many input items there are.
// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function
var replace = $node["Set"].json["Value"]
// Loop over inputs and add a new field called 'myNewField' to the JSON of each one
for (item of items) {
  item.json.Replaced = replace.replace(/\./g, ',');
}

// You can write logs to the browser console
console.log('Done!');

return items;

```

 ![Screenshot_20211016-035939](https://europe1.discourse-cdn.com/n8n/original/2X/5/591705396b2b5904175f08c0ab868467dd843300.png)

As you can see in the above screenshot. The point has been changed to comma.

---

<div class="post-metadata">

**Author:** ![Aleix\_Iglesias](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/aleix_iglesias/32/2882_2.png) [@Aleix\_Iglesias](https://community.n8n.io/u/Aleix_Iglesias)\
**Post date:** [October 16, 2021, 7:11pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/3 "2021-10-16T19:11:50Z")

</div>

Wow, it worked perfectly! Thank you!

---

<div class="post-metadata">

**Author:** ![mcnaveen](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mcnaveen/32/53924_2.png) [@mcnaveen](https://community.n8n.io/u/mcnaveen)\
**Post date:** [October 16, 2021, 7:57pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/4 "2021-10-16T19:57:15Z")

</div>

Glad it worked. ❤ Enjoy 🎉

---

<div class="post-metadata">

**Author:** ![luisalrp](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/luisalrp/32/8230_2.png) [@luisalrp](https://community.n8n.io/u/luisalrp)\
**Post date:** [December 5, 2021, 12:30pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/5 "2021-12-05T12:30:47Z")

</div>

Hello,

I am trying to replace a “.” with a “,” following your example but execution says “TypeError: replace.replace is not a function”.

The code is:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/4/43938162ef70c658a0b3f626060f0043be728196.png)

The workflow is:

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/e/ef574dc1b1fdd8a67106a61a8198aa80f84dbafd.png)

I need to replace the “.” for a “,” in the values of tvl.

Any idea what I am doing wrong? Thanks!

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [December 5, 2021, 3:23pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/6 "2021-12-05T15:23:18Z")

</div>

I assume that the type of that property is `Number` and not `String`. So you would first have to convert it first to a string.

Meaning the line would be:

```javascript
var replace = $node['HTTP Request'].json["tvl"].toString();

```

actually would also make the most sense to also move the `.replace` up to that line and remove it from the loop.

---

<div class="post-metadata">

**Author:** ![luisalrp](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/luisalrp/32/8230_2.png) [@luisalrp](https://community.n8n.io/u/luisalrp)\
**Post date:** [December 5, 2021, 3:46pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/7 "2021-12-05T15:46:40Z")

</div>

> [@jan](#):
>
> `var replace = $node['HTTP Request'].json["tvl"].toString();`

Thaanks @jan it worked. Here is what I finally did:

```auto
// Loop over inputs and add a new field called 'myNewField' to the JSON of each one
for (item of items) {
  item.json.tvl = item.json.tvl.toString().replace(/\./g, ',');
}

// You can write logs to the browser console
console.log('Done!');

return items;

```

I needed the loop because withput it, every value was the same.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [December 5, 2021, 4:05pm UTC](https://community.n8n.io/t/change-for-inside-json/8508/8 "2021-12-05T16:05:12Z")

</div>

Glad to hear that it worked. Have fun!
