Discussion
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
Last activity: 18 May 2022 11:48 EDT
Generate Data Model (properties, classes) from JSON
I have the below JSON Structure and would like to generate the corresponding data model (properties and classes).
How do i do that? Should i do it manually. Do we have any OOTB way of parsing json and creating data model
***Updated by Moderator: Marissa to add Feedback ID to post***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Updated: 27 Apr 2022 16:38 EDT
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
Hi Haria,
If you run through the REST CONNECTOR wizard; about half way through the wizard - you get a screen with a 'request' and 'response' tab: if you click the 'response' tab and use the '+' plus button , you can provide a sample JSON input to the wizard.
Post back here if you can't get this working (also provide your PRPC version and your JSON example [if possible]).
Thanks,
John
Updated: 27 Apr 2022 16:38 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
Thanks John.
I have already generated the rest connector and have skipped the data model step. How do i get back to that step?
Below is my JSON:
{
"recipient":{
"id":"1213s549"
},
"message":{
"text":"Pick a color:",
"quick_replies":[
{
"content_type":"text",
"title":"Red",
"payload":"MYRedColor"
},
{
"content_type":"text",
"title":"Green",
"payload":"MYGreenColor"
}
]
}
}
Updated: 27 Apr 2022 16:38 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
BTW, above mentioned JSON is the request template not the response.
Need any OOTB way of generating data model from the JSON.
Thanks
Updated: 27 Apr 2022 16:38 EDT
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
You should be able to create the model from the response - what version of PRPC are you using ?
Updated: 27 Apr 2022 16:38 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
i'm using 7.2.2 version.
I tried pasting the above JSON in response section. However, the response section seems to be readonly.
The rest connector wizard expects some response from the input.. The input is json.
My requirement is to generate the data model for the input structure not response.
Updated: 27 Apr 2022 16:38 EDT
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
EDIT: I just noticed that my powers of observation aren't great. Doh !
I'll leave my original POST here for reference, but in fact - the process is a lot simpler than what I did here.
You can just upload the 'test.json' directly at step #4. (you don't have to bother 'hosting' a JSON file behind a web server at all). I rechecked this with an uploaded file: it works ! but I didn't want to re-take all my screenshots).
This is what I did:
1. I took your JSON and saved it behind my Tomcat Server as 'test.json'.
That is: on my PRPC Server's Tomcat (but you can choose any webserver that is reachable by PRPC in fact); I put the JSON in a file like this:
<apache-tomcat>\webapps\ROOT\test.json
And I confirmed (in a browser) that I was able to retrieve this JSON over HTTP - just by doing :
Then I proceeded through the wizard like this:
EDIT: I just noticed that my powers of observation aren't great. Doh !
I'll leave my original POST here for reference, but in fact - the process is a lot simpler than what I did here.
You can just upload the 'test.json' directly at step #4. (you don't have to bother 'hosting' a JSON file behind a web server at all). I rechecked this with an uploaded file: it works ! but I didn't want to re-take all my screenshots).
This is what I did:
1. I took your JSON and saved it behind my Tomcat Server as 'test.json'.
That is: on my PRPC Server's Tomcat (but you can choose any webserver that is reachable by PRPC in fact); I put the JSON in a file like this:
<apache-tomcat>\webapps\ROOT\test.json
And I confirmed (in a browser) that I was able to retrieve this JSON over HTTP - just by doing :
Then I proceeded through the wizard like this:
1. DESIGNER STUDIO > Integration > Connectors > Create REST Integration
2. Connection: URL for JSON file to 'Endpoint URL':
3. Name the Resource: I just used 'Test'. Optionally change the Method (actually you don't need to do this)
4. Use 'Add a REST response', and 'Run' a connection to retrieve the JSON.
[See my note above: if you already have the JSON in a file; just use 'Add a file' instead].
5. Review what PRPC will build (you can click 'preview' here also as well if you want).
6. Confirm PRPC has built the rules to match the JSON - note the name of the Data Class created.
7. Compare the Data Model with the original JSON:
Hope this helps - can you run through this and see whether this works for you ?
Did I understand your requirement properly ?
Cheers
John
Updated: 27 Apr 2022 16:38 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Morgan Stanley
IN
Many thanks for the reply John.
This works for me.
It would have been great if PRPC allowed us to edit the response/paste this external json directly :(
Updated: 27 Apr 2022 16:38 EDT
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/35/REG-34624.png?source=PUMINIT)
Pegasystems Inc.
GB
@haria.
I have logged an Enhancement (AKA 'feedback') request here:
FDBK-18642 : Direct Paste of JSON (as well as upload file/test response).
Thanks for the feedback !
John
Updated: 27 Apr 2022 16:38 EDT
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Vodafone
IN
Hi JOHNPW_GCS ,
May I know server path for weblogic to place json file please?