# String replacing error

**URL:** <https://forum.ionicframework.com/t/string-replacing-error/125328>\
**Category:** ionic-v3\
**Created:** [March 21, 2018, 5:23am UTC](https://forum.ionicframework.com/t/string-replacing-error/125328 "2018-03-21T05:23:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flycoders\_sourav](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@flycoders\_sourav](https://forum.ionicframework.com/u/flycoders_sourav)\
**Post date:** [March 21, 2018, 5:23am UTC](https://forum.ionicframework.com/t/string-replacing-error/125328/1 "2018-03-21T05:23:07Z")

</div>

When i try to replace the string showing this error

 ![error123](https://global.discourse-cdn.com/ionicframework/original/3X/b/c/bc1f184a86db0f03ad870e88d7aa61af55f2c2d2.png)  
**below my code:"**

```auto
export class HomePage {

	  qrData = null;
	  qrData2= null;
  	createdCode = null;
  	createdCode2:string;
  	scannedCode = null;
	  data:any = {};

 
  constructor(public navCtrl: NavController) {
  	this.data.qrData = '';
  	this.data.qrData2 = '';

  }

    createCode() {
    this.createdCode = JSON.stringify(this.data);
     let jsonString = this.createCode;
     jsonString = jsonString.replace(/("{|}")/gi,'"');

  }

```

Please help me anyone  
Thanks

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [March 21, 2018, 5:39am UTC](https://forum.ionicframework.com/t/string-replacing-error/125328/2 "2018-03-21T05:39:02Z")

</div>

> [@flycoders\_sourav](#):
>
> let jsonString = this.createCode;

typo. jsonString becomes the function createCode, where you probably want createdCode

> [@flycoders\_sourav](#):
>
> let jsonString = this.createdCode;

---

<div class="post-metadata">

**Author:** ![flycoders\_sourav](https://avatars.discourse-cdn.com/v4/letter/f/e47c2d/32.png) [@flycoders\_sourav](https://forum.ionicframework.com/u/flycoders_sourav)\
**Post date:** [March 21, 2018, 5:40am UTC](https://forum.ionicframework.com/t/string-replacing-error/125328/3 "2018-03-21T05:40:28Z")

</div>

can you give me the example of code how to remove quotation from string

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [March 21, 2018, 11:40am UTC](https://forum.ionicframework.com/t/string-replacing-error/125328/4 "2018-03-21T11:40:14Z")

</div>

They just told you what the problem is of your code. Did fixing it work?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:44pm UTC](https://forum.ionicframework.com/t/string-replacing-error/125328/5 "2021-07-19T21:44:17Z")

</div>

Closed on July 19, 2021, 9:44pm UTC


