Guide Result Object result in XML

Avatar

Avatar
Springboard
Level 1
gargrohan
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Springboard
Establish
Validate 1
Ignite 1
Give Back
View profile

Avatar
Springboard
Level 1
gargrohan
Level 1

Likes

0 likes

Total Posts

16 posts

Correct reply

0 solutions
Top badges earned
Springboard
Establish
Validate 1
Ignite 1
Give Back
View profile
gargrohan
Level 1

25-06-2021

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile

Avatar
Springboard
Level 10
Mayank_Gandhi
Level 10

Likes

327 likes

Total Posts

1,150 posts

Correct reply

185 solutions
Top badges earned
Springboard
Establish
Validate 1
Contributor 2
Ignite 5
View profile
Mayank_Gandhi
Level 10

25-06-2021

@gargrohan 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.

https://experienceleague.adobe.com/docs/experience-manager-65/forms/adaptive-forms-advanced-authorin...

Answers (1)

Answers (1)

Avatar

Avatar
Affirm 25
Employee
PulkitJain
Employee

Likes

85 likes

Total Posts

86 posts

Correct reply

41 solutions
Top badges earned
Affirm 25
Boost 50
Give Back 10
Establish
Boost 25
View profile

Avatar
Affirm 25
Employee
PulkitJain
Employee

Likes

85 likes

Total Posts

86 posts

Correct reply

41 solutions
Top badges earned
Affirm 25
Boost 50
Give Back 10
Establish
Boost 25
View profile
PulkitJain
Employee

25-06-2021

@gargrohan 

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!