Question
how to construct JSON request
Hi All ,
I have to populate a JSON request in below format to call a Connect-rest service , appreciate your help if you can guide me on this .
Thanks.
JSON format :
{
"Metadata":
{
"Alternate":true,
"Branch":branch,
},
"Documents":[
{
"Name":"NameOfDocument2",
"Track":track,
},
{
"Name":"NameOfDocument3",
"Track":tranck,
},
]
}
Which version of Pega are you on? In Pega 7.x versions, there is a REST wizard to guide you through the process of creating a REST connector. You could upload your JSON sample and the wizard would automatically create classes and properties to aid you in mapping your request parameters.
As a side note, your JSON is syntactically invalid. The values of "Branch" and "Track" fields must be enclosed within quotes if they are strings. You could use JSON validator such as http://jsonlint.com/ to validate your JSON.