Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Here is my xml input which I'm trying to convert into json format by changing a particular json object into an array. I tried several ways but none of them worked. Here is my below xml:
<?xml version='1.0' encoding='utf-8' ?> <A> <Request> <Name>Market</Name> <User> <Type>NONE</Type> </User> <App> <VendorName VendorCode="80">Market</VendorName> <Name>Facebook</Name> </App> </Request> <MyRequest PrimaryObjectID="Primary"> <GUID>d61c1d010d08</GUID> <Type tc="10">ABCD</Type> <Date>2022-06-10</Date> <Time>08:20:08</Time> <M2> <Info> <CreationDate>2022-06-10</CreationDate> <CreationTime>08:20:08</CreationTime> <SourceInfoName>Market</SourceInfoName> </Info> <Info> <CreationDate>2022-06-11</CreationDate> <CreationTime>08:20:09</CreationTime> <SourceInfoName>Market 2</SourceInfoName> </Info> <Holding id="HPrimary"> <Marketplan> <PolNumber>T60</PolNumber> <ProductCode>Code</ProductCode> <PlanName>Plan</PlanName> <Status tc="8">Status</Status> <ReplacementType tc="9">Replace</ReplacementType> <Mode tc="1">Online</Mode> <Method tc="2">Online</Method> <Stock> <Stocks> <PlanName>Plan</PlanName> <IndicatorCode tc="1">B</IndicatorCode> <CurrentAmt>292</CurrentAmt> <Period>10</Period> <CovOption> <PlanName>Name1</PlanName> <OptionAmt>0</OptionAmt> </CovOption> <MarketParticipant id="MarketParticipant_Primary" PartyID="Party"> <MarketParticipantRoleCode tc="1">Primary</MarketParticipantRoleCode> <Class tc="2100007">L</Class> </MarketParticipant> <MarketParticipant id="MarketParticipant_Owner" PartyID="Party_Owner"> <MarketParticipantRoleCode tc="18">Owner</MarketParticipantRoleCode> </MarketParticipant> <MarketParticipant id="MarketParticipant_Payor" PartyID="Party_0"> <MarketParticipantRoleCode tc="12">Owner2</MarketParticipantRoleCode> </MarketParticipant> <MarketParticipant id="MarketParticipant_Primary" PartyID="Party_Primary"> <MarketParticipantRoleCode tc="15">Owner3</MarketParticipantRoleCode> </MarketParticipant> <MarketParticipant id="MarketParticipant_Primary2" PartyID="Party_1" DataRep="Partial"> <MarketParticipantRoleCode tc="7">Owner4</MarketParticipantRoleCode> <BeneficiaryPercentDistribution>20</BeneficiaryPercentDistribution> </MarketParticipant> <MarketParticipant id="MarketParticipant_Primary3" PartyID="Party_2" DataRep="Partial"> <MarketParticipantRoleCode tc="7">Owner12</MarketParticipantRoleCode> <BeneficiaryPercentDistribution>40</BeneficiaryPercentDistribution> </MarketParticipant> <MarketParticipant id="MarketParticipant_PrimaryB_3" PartyID="Party_01_3" DataRep="Partial"> <MarketParticipantRoleCode tc="7">Owner41</MarketParticipantRoleCode> <BeneficiaryPercentDistribution>40</BeneficiaryPercentDistribution> </MarketParticipant> <MarketParticipant id="MarketParticipant_PrimaryBC_1" PartyID="Party_00_1" DataRep="Partial"> <MarketParticipantRoleCode tc="9">Owner5</MarketParticipantRoleCode> <BeneficiaryPercentDistribution>100</BeneficiaryPercentDistribution> </MarketParticipant> </Stocks> </Stock> <Marketinfo> <TrackingID>yVkJi76-jtUZRo-k0=</TrackingID> <ApplicationJurisdiction tc="17">IL</ApplicationJurisdiction> <ApplicationType tc="1">New Business</ApplicationType> <SubmissionDate>2022-06-10</SubmissionDate> <SInfo> <RoleCode tc="15">Primary0</RoleCode> <Date>2022-06-10</Date> <State tc="17">100</State> <OK tc="1">True</OK> </SInfo> <SInfo> <RoleCode tc="15">Primary1</RoleCode> <Date>2022-06-10</Date> <State tc="17">000</State> <OK tc="1">True</OK> </SInfo> <EExtension VendorCode="20" /> </Marketinfo> <EExtension VendorCode="20"> <LapseNoticeDesignee tc="1">Yes</LapseNoticeDesignee> <LapseNoticeDesigneeFirstName>Timmy</LapseNoticeDesigneeFirstName> <LapseNoticeDesigneeLastName>joy</LapseNoticeDesigneeLastName> <LapseNoticeDesigneeStreet>72</LapseNoticeDesigneeStreet> <LapseNoticeDesigneeCity>F</LapseNoticeDesigneeCity> <LapseNoticeDesigneeState>ooo</LapseNoticeDesigneeState> <LapseNoticeDesigneeZip>600000</LapseNoticeDesigneeZip> <LapseNoticeDesigneeEmail>gmail</LapseNoticeDesigneeEmail> <LapseNoticeDesigneePhone>9211111111</LapseNoticeDesigneePhone> </EExtension> </Marketplan> </Holding> <Party id="Party_Primary"> <PartyTypeCode tc="1">P</PartyTypeCode> <GID>27551</GID> <C tc="1">abcd Market Id</C> <Person DataRep="Partial"> <FirstName>J</FirstName> <MiddleName/> <LastName>Wel</LastName> <Occupation>Employ</Occupation> <Gender tc="1">Male</Gender> <BirthDate>1973-07-08</BirthDate> <Height2> <MeasureValue>58</MeasureValue> </Height2> <Weight2> <MeasureValue>101</MeasureValue> </Weight2> </Person> <Address><Line1>Line1</Line1><City>Line2</City><AddressStateTC tc="17">Line3</AddressStateTC><Zip>Line4</Zip></Address> <Phone> <AreaCode>8008</AreaCode> <DialNumber>76</DialNumber> </Phone> <EMailAddress> <AddrLine>test.com</AddrLine> </EMailAddress> </Party> <Party id="Party_Owner"> <PartyTypeCode tc="1">Person</PartyTypeCode> <GID>275951</GID> <GC tc="1">Abcd</GC> <Person DataRep="Partial"> <FirstName>Jp</FirstName> <MiddleName/> <LastName>Wella</LastName> <BirthDate>1973-07-08</BirthDate> </Person> <Address><Line1>Line1</Line1><City>Line2</City><AddressStateTC tc="17">Line3</AddressStateTC><Zip>Line4</Zip></Address> <EMailAddress> <AddrLine>test.com</AddrLine> </EMailAddress> </Party> <Party id="Party_Pay"> <PartyTypeCode tc="1">Person</PartyTypeCode> <GID>275951</GID> <GC tc="1">GC</GC> <Person DataRep="Partial"> <FirstName>M</FirstName> <MiddleName/> <LastName>W</LastName> <BirthDate>1973-07-08</BirthDate> </Person> <Address><Line1>Line1</Line1><City>Line1</City><AddressStateTC tc="17">Line1</AddressStateTC><Zip>Line1</Zip></Address> <EMailAddress> <AddrLine>test.com</AddrLine> </EMailAddress> </Party> <Party id="Party_Primary"> <PartyTypeCode tc="1">Person</PartyTypeCode> <Marketer> <CarrierAppointment> <ID>500</ID> </CarrierAppointment> </Marketer> </Party> <Party id="Party_PrimaryBene_1"> <PartyTypeCode tc="1">Person</PartyTypeCode> <ID>8745478</ID> <GC tc="1">GCC1</GC> <Person DataRep="Partial"> <FirstName>R</FirstName> <MiddleName>A</MiddleName> <LastName>JR</LastName> <BirthDate>1988-01-07</BirthDate> </Person> </Party> <Party id="Party_PrimaryB_2"> <PartyTypeCode tc="1">Person</PartyTypeCode> <ID>8745478</ID> <GC tc="1">GCC1</GC> <Person DataRep="Partial"> <FirstName>R</FirstName> <MiddleName>A</MiddleName> <LastName>JR</LastName> <BirthDate>1988-01-07</BirthDate> </Person> </Party> <Party id="Party_PrimaryB_3"> <PartyTypeCode tc="1">Person</PartyTypeCode> <ID>8745478</ID> <GC tc="1">GCC1</GC> <Person DataRep="Partial"> <FirstName>R</FirstName> <MiddleName>A</MiddleName> <LastName>JR</LastName> <BirthDate>1988-01-07</BirthDate> </Person> </Party> <Party id="Party_ContingentB_1"> <PartyTypeCode tc="1">Person</PartyTypeCode> <ID>8745478</ID> <GC tc="1">GCC1</GC> <Person DataRep="Partial"> <FirstName>R</FirstName> <MiddleName>A</MiddleName> <LastName>JR</LastName> <BirthDate>1988-01-07</BirthDate> </Person> </Party> <Relation id="id" OriginatingObjectID="Party_Primary" RelatedObjectID="Party_Owner"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="168">Self</RelationRoleCode> </Relation> <Relation id="Relation_PayorToPrimaryInsured" OriginatingObjectID="Party_PrimaryInsured" RelatedObjectID="Party_Owner1"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="168">Self</RelationRoleCode> </Relation> <Relation id="Relation_PrimaryBene1ToPrimaryInsured" OriginatingObjectID="Party_PrimaryInsured" RelatedObjectID="Party_Owner2"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="1">Spouse</RelationRoleCode> </Relation> <Relation id="Relation_PrimaryBene2ToPrimaryInsured" OriginatingObjectID="Party_PrimaryInsured" RelatedObjectID="Party_Owner3"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="100017">Son</RelationRoleCode> </Relation> <Relation id="Relation_PrimaryBene3ToPrimaryInsured" OriginatingObjectID="Party_PrimaryInsured" RelatedObjectID="Party_Owner4"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="100009">Mother</RelationRoleCode> </Relation> <Relation id="Relation_ContingentBene1ToPrimaryInsured" OriginatingObjectID="Party_PrimaryInsured" RelatedObjectID="Party_Owner4"> <OriginatingObjectType tc="6">Party</OriginatingObjectType> <RelatedObjectType tc="6">Party</RelatedObjectType> <RelationRoleCode tc="100007">Father</RelationRoleCode> </Relation> <Form id="GV"> <FormName>GV</FormName> <Attachment> <Id>85ff914e-d510430197df</Id> <ImageType tc="4">pdf</ImageType> </Attachment> </Form> <Form id="GV1"> <FormName>GV1</FormName> <Attachment> <Id>85ff914e-d510430197df</Id> <ImageType tc="4">pdf</ImageType> </Attachment> </Form> <Form id="GV2"> <FormName>GV</FormName> <Attachment> <Id>85ff914e-d510430197df</Id> <ImageType tc="4">pdf</ImageType> </Attachment> </Form> <Form id="GV3"> <FormName>GV</FormName> <Attachment> <Id>85ff914e-d510430197df</Id> <ImageType tc="4">pdf</ImageType> </Attachment> </Form> </M2> </MyRequest> </A>
Here is my desired Output:
{"A": { "Request": { "Name": "Market", "User": {"Type": "NONE"}, "App": { "VendorName": { "VendorCode": "80", "text": "Market" }, "Name": "Facebook" } }, "MyRequest": { "PrimaryObjectID": "Primary", "GUID": "d61c1d010d08", "Type": { "tc": "10", "text": "ABCD" }, "Date": "2022-06-10", "Time": "08:20:08", "M2": { "Info": [ //This is the array which I'm trying to add { "CreationDate": "2022-06-11", "CreationTime": "08:20:09", "SourceInfoName": "Market 2" } ], "Holding": { "id": "HPrimary", "Marketplan": { "PolNumber": "T60", "ProductCode": "Code", "PlanName": "Plan", "Status": { "tc": "8", "text": "Status" }, "ReplacementType": { "tc": "9", "text": "Replace" }, "Mode": { "tc": "1", "text": "Online" }, "Method": { "tc": "2", "text": "Online" }, "Stock": {"Stocks": { "PlanName": "Plan", "IndicatorCode": { "tc": "1", "text": "B" }, "CurrentAmt": "292", "Period": "10", "CovOption": { "PlanName": "Name1", "OptionAmt": "0" }, "MarketParticipant": [ { "id": "MarketParticipant_Primary", "PartyID": "Party", "MarketParticipantRoleCode": { "tc": "1", "text": "Primary" }, "Class": { "tc": "2100007", "text": "L" } }, { "id": "MarketParticipant_Owner", "PartyID": "Party_Owner", "MarketParticipantRoleCode": { "tc": "18", "text": "Owner" } }, { "id": "MarketParticipant_Payor", "PartyID": "Party_0", "MarketParticipantRoleCode": { "tc": "12", "text": "Owner2" } }, { "id": "MarketParticipant_Primary", "PartyID": "Party_Primary", "MarketParticipantRoleCode": { "tc": "15", "text": "Owner3" } }, { "id": "MarketParticipant_Primary2", "PartyID": "Party_1", "DataRep": "Partial", "MarketParticipantRoleCode": { "tc": "7", "text": "Owner4" }, "BeneficiaryPercentDistribution": "20" }, { "id": "MarketParticipant_Primary3", "PartyID": "Party_2", "DataRep": "Partial", "MarketParticipantRoleCode": { "tc": "7", "text": "Owner12" }, "BeneficiaryPercentDistribution": "40" }, { "id": "MarketParticipant_PrimaryB_3", "PartyID": "Party_01_3", "DataRep": "Partial", "MarketParticipantRoleCode": { "tc": "7", "text": "Owner41" }, "BeneficiaryPercentDistribution": "40" }, { "id": "MarketParticipant_PrimaryBC_1", "PartyID": "Party_00_1", "DataRep": "Partial", "MarketParticipantRoleCode": { "tc": "9", "text": "Owner5" }, "BeneficiaryPercentDistribution": "100" } ] }}, "Marketinfo": { "TrackingID": "yVkJi76-jtUZRo-k0=", "ApplicationJurisdiction": { "tc": "17", "text": "IL" }, "ApplicationType": { "tc": "1", "text": "New Business" }, "SubmissionDate": "2022-06-10", "SInfo": [ { "RoleCode": { "tc": "15", "text": "Primary0" }, "Date": "2022-06-10", "State": { "tc": "17", "text": "100" }, "OK": { "tc": "1", "text": "True" } }, { "RoleCode": { "tc": "15", "text": "Primary1" }, "Date": "2022-06-10", "State": { "tc": "17", "text": "000" }, "OK": { "tc": "1", "text": "True" } } ], "EExtension": {"VendorCode": "20"} }, "EExtension": { "VendorCode": "20", "LapseNoticeDesignee": { "tc": "1", "text": "Yes" }, "LapseNoticeDesigneeFirstName": "Timmy", "LapseNoticeDesigneeLastName": "joy", "LapseNoticeDesigneeStreet": "72", "LapseNoticeDesigneeCity": "F", "LapseNoticeDesigneeState": "ooo", "LapseNoticeDesigneeZip": "600000", "LapseNoticeDesigneeEmail": "gmail", "LapseNoticeDesigneePhone": "9211111111" } } }, "Party": [ { "id": "Party_Primary", "PartyTypeCode": { "tc": "1", "text": "P" }, "GID": "27551", "C": { "tc": "1", "text": "abcd Market Id" }, "Person": { "DataRep": "Partial", "FirstName": "J", "MiddleName": "", "LastName": "Wel", "Occupation": "Employ", "Gender": { "tc": "1", "text": "Male" }, "BirthDate": "1973-07-08", "Height2": {"MeasureValue": "58"}, "Weight2": {"MeasureValue": "101"} }, "Address": { "Line1": "Line1", "City": "Line2", "AddressStateTC": { "tc": "17", "text": "Line3" }, "Zip": "Line4" }, "Phone": { "AreaCode": "8008", "DialNumber": "76" }, "EMailAddress": {"AddrLine": "test.com"} }, { "id": "Party_Owner", "PartyTypeCode": { "tc": "1", "text": "Person" }, "GID": "275951", "GC": { "tc": "1", "text": "Abcd" }, "Person": { "DataRep": "Partial", "FirstName": "Jp", "MiddleName": "", "LastName": "Wella", "BirthDate": "1973-07-08" }, "Address": { "Line1": "Line1", "City": "Line2", "AddressStateTC": { "tc": "17", "text": "Line3" }, "Zip": "Line4" }, "EMailAddress": {"AddrLine": "test.com"} }, { "id": "Party_Pay", "PartyTypeCode": { "tc": "1", "text": "Person" }, "GID": "275951", "GC": { "tc": "1", "text": "GC" }, "Person": { "DataRep": "Partial", "FirstName": "M", "MiddleName": "", "LastName": "W", "BirthDate": "1973-07-08" }, "Address": { "Line1": "Line1", "City": "Line1", "AddressStateTC": { "tc": "17", "text": "Line1" }, "Zip": "Line1" }, "EMailAddress": {"AddrLine": "test.com"} }, { "id": "Party_Primary", "PartyTypeCode": { "tc": "1", "text": "Person" }, "Marketer": {"CarrierAppointment": {"ID": "500"}} }, { "id": "Party_PrimaryBene_1", "PartyTypeCode": { "tc": "1", "text": "Person" }, "ID": "8745478", "GC": { "tc": "1", "text": "GCC1" }, "Person": { "DataRep": "Partial", "FirstName": "R", "MiddleName": "A", "LastName": "JR", "BirthDate": "1988-01-07" } }, { "id": "Party_PrimaryB_2", "PartyTypeCode": { "tc": "1", "text": "Person" }, "ID": "8745478", "GC": { "tc": "1", "text": "GCC1" }, "Person": { "DataRep": "Partial", "FirstName": "R", "MiddleName": "A", "LastName": "JR", "BirthDate": "1988-01-07" } }, { "id": "Party_PrimaryB_3", "PartyTypeCode": { "tc": "1", "text": "Person" }, "ID": "8745478", "GC": { "tc": "1", "text": "GCC1" }, "Person": { "DataRep": "Partial", "FirstName": "R", "MiddleName": "A", "LastName": "JR", "BirthDate": "1988-01-07" } }, { "id": "Party_ContingentB_1", "PartyTypeCode": { "tc": "1", "text": "Person" }, "ID": "8745478", "GC": { "tc": "1", "text": "GCC1" }, "Person": { "DataRep": "Partial", "FirstName": "R", "MiddleName": "A", "LastName": "JR", "BirthDate": "1988-01-07" } } ], "Relation": [ { "id": "id", "OriginatingObjectID": "Party_Primary", "RelatedObjectID": "Party_Owner", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "168", "text": "Self" } }, { "id": "Relation_PayorToPrimaryInsured", "OriginatingObjectID": "Party_PrimaryInsured", "RelatedObjectID": "Party_Owner1", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "168", "text": "Self" } }, { "id": "Relation_PrimaryBene1ToPrimaryInsured", "OriginatingObjectID": "Party_PrimaryInsured", "RelatedObjectID": "Party_Owner2", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "1", "text": "Spouse" } }, { "id": "Relation_PrimaryBene2ToPrimaryInsured", "OriginatingObjectID": "Party_PrimaryInsured", "RelatedObjectID": "Party_Owner3", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "100017", "text": "Son" } }, { "id": "Relation_PrimaryBene3ToPrimaryInsured", "OriginatingObjectID": "Party_PrimaryInsured", "RelatedObjectID": "Party_Owner4", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "100009", "text": "Mother" } }, { "id": "Relation_ContingentBene1ToPrimaryInsured", "OriginatingObjectID": "Party_PrimaryInsured", "RelatedObjectID": "Party_Owner4", "OriginatingObjectType": { "tc": "6", "text": "Party" }, "RelatedObjectType": { "tc": "6", "text": "Party" }, "RelationRoleCode": { "tc": "100007", "text": "Father" } } ], "Form": [ { "id": "GV", "FormName": "GV", "Attachment": { "Id": "85ff914e-d510430197df", "ImageType": { "tc": "4", "text": "pdf" } } }, { "id": "GV1", "FormName": "GV1", "Attachment": { "Id": "85ff914e-d510430197df", "ImageType": { "tc": "4", "text": "pdf" } } }, { "id": "GV2", "FormName": "GV", "Attachment": { "Id": "85ff914e-d510430197df", "ImageType": { "tc": "4", "text": "pdf" } } }, { "id": "GV3", "FormName": "GV", "Attachment": { "Id": "85ff914e-d510430197df", "ImageType": { "tc": "4", "text": "pdf" } } } ] } } }}
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to convert an xml into json using xslt?
Here is my xml input which I'm trying to convert into json format by changing a particular json object into an array. I tried several ways but none of them worked. Here is my below xml:
Here is my desired Output:
is working on a reply...