Question

Replace only Name with name not LastName with Lastname in JSON String

in my JSON String i want to Name with name but when i am using replaceAll function it is replacing LastName with Lastname i dont wnat that. Can you please help me to resolve this issue.

***Moderator Edit-Vidyaranjan: Updated Platform Capability***

Comments

Keep up to date on this post and subscribe to comments

Pega
November 12, 2019 - 11:01pm

Hi ,

Please share the details of this usecase , i.e  where you have tried this? Are you creating your own JSON and trying it some where ?

Version of the pega will also help us.

November 13, 2019 - 9:39am

Possible solutions:

1. Replase not "Name" to "name", but " Name" to " name" with a space in the beginning

2. Firstly, replase all "LastName" to something like "LastNam", then do your replase all "Name" to "name". At the end replace back "LastNam" to "LastName"

Pega
November 14, 2019 - 12:30am

If you want to do this in integration layer, you can try with pzExternalName property qualifier for the property Name to map it as "name" while generating JSON or the other way.

If  you want to do pure string manipulation, then  you can try different options (like what Vaspoz suggested here).