Hi All,
I am new to AEM Forms. I am using GuidBridge API to get form data.
guideBridge.getData({
success : function (guideResultObject) {
console.log("data received" + guideResultObject.data);
}
error : function (guideResultObject) {
console.error("API Failed");
var msg = guideResultObject.getNextMessage();
while (msg != null) {
console.error(msg.message);
msg = guideResultObject.getNextMessage();
}
}
});
However, I need the result in JSON format. The result is being logged in XML format as shown below -
<?xml version="1.0" encoding="UTF-8"?>
<afData>
<afUnboundData>
<data>
<tag1>234561234567890987654</tag1>
<tag2>xcvghjklkjh</tag2>
</data>
</afUnboundData>
<afBoundData>
<data
xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\"/>
</afBoundData>
<afSubmissionInfo>
<lastFocusItem>guide[0].guide1[0].guideRootPanel[0].RandomForm[0].companyDetails[0]</lastFocusItem>
<computedMetaInfo/>
<stateOverrides/>
<signers/>
<afPath>/content/dam/formsanddocuments//randomPath</afPath>
<afSubmissionTime>20210625074410</afSubmissionTime>
</afSubmissionInfo>
</afData>
How can I get the guideResultObj.data to be in JSON format ?
The form does not have any JSON schema associated with it as it was created with a blank template.
Solved! Go to Solution.
Views
Replies
Total Likes
@sg-aem You are using correct api but the approach need to be changed. You will get json only if the form is bound to a json schema.
Same api will result in json instead of XML.
Navigate to form properties and map json schema to the form. Now go to form objects and bind the field as required and call the api and, that's it.
You should be able to convert the XML into JSON format as below:
guideBridge.getData(
{
success : function (guideResultObject)
{
FormData= $.parseJSON(guideResultObject.data);
});
Hope this helps!
@sg-aem You are using correct api but the approach need to be changed. You will get json only if the form is bound to a json schema.
Same api will result in json instead of XML.
Navigate to form properties and map json schema to the form. Now go to form objects and bind the field as required and call the api and, that's it.
Views
Likes
Replies
Views
Likes
Replies