1. Vipin Dwivedi
  2. PowerBuilder
  3. Thursday, 16 June 2022 23:16 PM UTC

Hello Appeon Team,

I am working to create the JSON using JSONGenerator and then making httpclient call to send those Json file as payload. We have frontend screen to take JSON fields value like comment, sales number, qty etc. The comment box is a text editor where user can enter any value. What if user enter the reserved characters which we can't use in JSON. In order to use those reserved character we may have to use the escape character.

 

Do we have any inbuild mechanism to parse these JSON string to ensure they will not fail when sending as payload?

Please recommend some full proof and working code/suggestion.

 

Vipin

Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 28 June 2022 09:11 AM UTC
  2. PowerBuilder
  3. # 1

Hi Vipin,

 

Please refer to PB help documentation. PB current support "A plain JSON follows the industry standard JSON format (as specified in https://www.json.org)" 

https://docs.appeon.com/pb2021/application_techniques/Using_RESTFul_Web_Services_with_JSON.html#supported_json_formats

 

Therefore, if the JSON itself has keywords, reserved words, escape sequences, etc., the same rule also applies to JSON content used in PB.

 

Regards,

 

Comment
There are no comments made yet.
Benjamin Gaesslein Accepted Answer Pending Moderation
  1. Friday, 17 June 2022 11:54 AM UTC
  2. PowerBuilder
  3. # 2

I haven't tested it but the AddItemString function of JSONGenerator should escape every character in the string that needs it.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.