Financial Services - XML & JSON APIs Overview

Financial Services - XML & JSON APIs Overview
Slide Note
Embed
Share

Financial Services are providing more JSON APIs and integrating financial systems using XML messages. Explore the journey of a simple payment across different XML standards and JSON specifications, including OpenBanking.org UK JSON and ISO 20022. Learn about conversion between XML and JSON, as well as how payment messages are transformed within the payment system.

  • Financial Services
  • XML
  • JSON
  • APIs
  • OpenBanking

Uploaded on Feb 28, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Financial Services - XML & JSON APIs Wednesday12th September 2018 summer school Financial Services - XML & JSON APIs Jason Polis jason.polis@json.plus Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 1

  2. Financial Services - XML & JSON APIs Overview summer school summer school Financial Services are providing more JSON APIs, yet have integrated financial systems using XML messages. You can instruct payment via a bank s JSON web service, whilst the bank settles payment using XML. What does a simple payment look like in various XML standards and JSON specifications? How can XML be converted to idiomatic JSON styles; and back again ? Together, let s follow the journey of a simple payment, to learn how it is transformed across a payment system. Along the way we'll look at OpenBanking.org.UK JSON, ISO 20022, and other useful standards. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 2

  3. Jason Polis - Bio summer school summer school Jason Polis helps banks transform, enrich & integrate financial data information systems. He s currently developing a Model Driven Architecture of a XML to JSON round trip transformation, to support a common approach across the following standards. OpenBanking, having worked on the OpenBanking UK specifications. ISO 20022 as a member of its Technical Support Group; FPML (Financial Products Markup Language) as member of the Architecture Working Group. Jason Polis has been an independent consultant in the financial services sector in the UK since 1999, with a special focus on systems integration using XML based standards. Prior to this he worked on internationalising several internet standards, general IT consulting and university lecturing on information systems. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 3

  4. Why Discuss this ? summer school summer school What is the current situation for payment messages ? How have XML JSON conversion issues been resolved so far ? What if there are better approaches? Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 4

  5. UK Financial Services - XML & JSON APIs summer school summer school OpenBanking.org.uk App facing web interfaces provided by banks in UK. UK CCM Common Credit Message A bank to bank customer credit transfer based on ISO 20022. json.plus Generic approaches to json transformation. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 5

  6. OpenBanking.org.uk summer school summer school OpenBanking.org.uk Setup by CMA9 9 retail banks under order by Competition and Markets Authority. EU s PSD2 Payment Services Directive 2, requiring payment services to use APIs. https://www.openbanking.org.uk/providers/standards/ Open Data API Branch and ATM services and locations. Product features of cards and current accounts. Account Information API Statements, balances, transactions, standing orders, scheduled payments, etc. Payment Initiation API Payments Pictures and code samples sourced from: https://openbanking.atlassian.net/wiki/spaces/DZ/pages/5786479/Payment+Initiation+API+Specification+-+v1.1.0 Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 6

  7. OpenBanking.org.uk Payment Initiation Process summer school summer school Payment Initiation Process 1. User instructs payment by App. 2. App requests bank to make payment. (payments resource) 3. User authorises bank to make payment. 4. App submits payment at bank. (payment-submissions resource) 5. App requests payment update from bank. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 7

  8. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment Initiation Data summer school summer school Payments Resource POST /payments request omits PaymentId, Status, and CreationDateTime Response includes them. GET /payments/{PaymentId} Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 8

  9. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment Example (1) Post payment - http headers summer school summer school POST /payments HTTP/1.1 HTTP/1.1 201 Created Authorization: Bearer 2YotnFZFEjr1zCsicMWpAA x-jws-signature: V2hhdCB3ZSBnb3QgaGVyZQ0K..aXMgZmFpb HVyZSB0byBjb21tdW5pY2F0ZQ0K x-idempotency-key: FRESCO.21302.GFX.20 x-jws-signature: TGlmZSdzIGEgam91cm5leSBub3QgYSBkZXN0aW 5hdGlvbiA=..T2ggZ29vZCBldmVuaW5nIG1yIH R5bGVyIGdvaW5nIGRvd24gPw== x-fapi-interaction-id: 93bac548- d2de-4546-b106-880a5018460d Content-Type: application/json x-fapi-financial-id: OB/2017/001 x-fapi-customer-last-logged-time: Sun, 10 Sep 2017 19:43:31 UTC x-fapi-customer-ip-address: 104.25.212.99 x-fapi-interaction-id: 93bac548-d2de- 4546-b106-880a5018460d Content-Type: application/json Accept: application/json Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 9

  10. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment Example (2) Post payment - body - Data summer school summer school { { "Data": { "Data": { "PaymentId": "58923", "Status": "AcceptedTechnicalValidation", "CreationDateTime": "2017-06-05T15:15:13+00:00", "Initiation": { "InstructionIdentification": "ACME412", "EndToEndIdentification": "FRESCO.21302.GFX.20 ", "InstructedAmount": { "Amount": "165.88", "Currency": "GBP" }, "CreditorAccount": { "SchemeName": "SortCodeAccountNumber", "Identification": "08080021325698", "Name": "ACME Inc", "SecondaryIdentification": "0002" }, "RemittanceInformation": { "Reference": "FRESCO-101", "Unstructured": "Internal ops code 5120101" } } }, "Initiation": { "InstructionIdentification": "ACME412", "EndToEndIdentification": "FRESCO.21302.GFX.20 ", "InstructedAmount": { "Amount": "165.88", "Currency": "GBP" }, "CreditorAccount": { "SchemeName": "SortCodeAccountNumber", "Identification": "08080021325698", "Name": "ACME Inc", "SecondaryIdentification": "0002" }, "RemittanceInformation": { "Reference": "FRESCO-101", "Unstructured": "Internal ops code 5120101" } } }, Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 10

  11. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment Example (3) Post payment - body - other summer school summer school "Risk": { "PaymentContextCode": "EcommerceGoods", "MerchantCategoryCode": "5967", "MerchantCustomerIdentification": "05359865 3254", "DeliveryAddress": { "AddressLine": [ "Flat 7", "Acacia Lodge" ], "StreetName": "Acacia Avenue", "BuildingNumber": "27", "PostCode": "GU31 2ZZ", "TownName": "Sparsholt", "CountySubDivision": [ "Wessex" ], "Country": "UK" } }, "Links": { "Self": "https://api.alphabank.com/open- banking/v1.0/payments/58923" }, "Meta": {} } "Risk": { "PaymentContextCode": "EcommerceGoods", "MerchantCategoryCode": "5967", "MerchantCustomerIdentification": "05359865 3254", "DeliveryAddress": { "AddressLine": [ "Flat 7", "Acacia Lodge" ], "StreetName": "Acacia Avenue", "BuildingNumber": "27", "PostCode": "GU31 2ZZ", "TownName": "Sparsholt", "CountySubDivision": [ "Wessex" ], "Country": "UK" } } } Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 11

  12. OpenBanking.org.uk Payment Initiation Process summer school summer school Payment Initiation Process 1. User instructs payment by App. 2. App requests bank to make payment. (payments resource) 3. User authorises bank to make payment. 4. App submits payment at bank. (payment-submissions resource) 5. App requests payment update from bank. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 12

  13. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment submission Data summer school summer school Payment-submissions Resource POST /payment-submissions Request as for payments, includes PaymentId omits Status, and CreationDateTime Response as per picture. GET /payment- submissions/{PaymentSubmissionId} Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 13

  14. Financial Services - XML & JSON APIs jason-polis@json.plus OpenBanking.org.uk Payment Example (1) Post payment submission - http headers summer school summer school POST /payment-submissions HTTP/1.1 Authorization: Bearer Jhingapulaav x-idempotency-key: FRESNO.1317.GFX.22 x-jws-signature: TGlmZSdzIGEgam91cm5leSBub3QgYSBkZXN0aW5hdGlvbiA =..T2ggZ29vZCBldmVuaW5nIG1yIHR5bGVyIGdvaW5nIGRv d24gPw== x-fapi-financial-id: OB/2017/001 x-fapi-customer-last-logged-time: Sun, 10 Sep 2017 19:43:31 UTC x-fapi-customer-ip-address: 104.25.212.99 x-fapi-interaction-id: 93bac548-d2de-4546-b106- 880a5018460d Content-Type: application/json Accept: application/json HTTP/1.1 201 Created x-jws-signature: V2hhdCB3ZSBnb3QgaGVyZQ0K..aXMgZmFpbHVyZSB0byBjb 21tdW5pY2F0ZQ0K x-fapi-interaction-id: 93bac548-d2de-4546-b106- 880a5018460d Content-Type: application/json { "Data": { "PaymentSubmissionId": "58923-001", "PaymentId": "58923", "Status": "AcceptedSettlementInProcess", "CreationDateTime": "2017-06- 05T15:15:22+00:00" }, "Links": { "Self": "https://api.alphabank.com/open- banking/v1.0/payment-submissions/58923-001" }, "Meta": {} } { "Data": { "PaymentId": "58923", "Initiation": { "InstructionIdentification": "ACME412", "EndToEndIdentification": "FRESCO.21302.G FX.20", "InstructedAmount": { ... Risk": { Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 14

  15. OpenBanking.org.uk Comments & Questions summer school summer school Comments JSON neatly follows hierarchical data model. Unordered data. Meta data only about whole resource, not its data items. Uses some terms from ISO 20022. Questions ? Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 15

  16. Financial Services - XML & JSON APIs jason-polis@json.plus UK Payment Systems - values and volumes summer school summer school Source : https://www.bankofengland.co.uk/-/media/boe/files/quarterly-bulletin/2012/the-boes-real-time-gross-settlement-infrastructure.pdf Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 16

  17. Financial Services - XML & JSON APIs jason-polis@json.plus UK Payment Systems - Participants summer school summer school Source: https://www.bankofengland.co.uk/-/media/boe/files/payments/iso-20022-consultation-paper.pdf BACS takes 3 working days. Typically used for bulk, regular or scheduled payments. Eg. Salaries, benefits, direct debits. Faster payments typically clear within 2 hours. CHAPS for same day high value such as buying property, interbank loans. RTGS is for banks, underpins these payment schemes, and also CREST for securities settlement. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 17

  18. Real Time Gross Settlement (RTGS) summer school summer school Real Time Gross Settlement Operated by Bank of England https://www.bankofengland.co.uk/-/media/boe/files/quarterly-bulletin/2012/the-boes-real-time-gross-settlement- infrastructure.pdf Supports monetary stability Interbank money market rates settlement agent between banks asset purchases using newly created central bank money ( quantitative easing ) and the more traditional open market operations that lend reserves to bank. Supports financial stability safe transfer of funds between parties ( final settlement ) the reserves that banks hold in accounts in the RTGS infrastructure provide a buffer against unexpected liquidity shocks lending funds against high-quality securities Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 18

  19. Financial Services - XML & JSON APIs jason-polis@json.plus UK Common Credit Message (CCM) summer school summer school UK Common Credit Message The major UK payments systems are moving to the new global messaging standard for payments known as ISO 20022 . This consultation seeks views on the proposed strategy for aligning credit payment messages across CHAPS, Bacs, and Faster Payments with the new global standard. Source: https://www.bankofengland.co.uk/-/media/boe/files/payments/iso-20022-consultation-paper.pdf Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 19

  20. CCM Customer Credit Transfer (pacs.008) summer school summer school CCM Developed as part of UK s New Payments Architecture (NPA) https://www.standardslibrary.org/Docs/StandardsSource/HTML/RTGS2/011.htm (requires sign up) Based on ISO 20022 pacs.008.001.07 FIToFICustomerCreditTransferV0n_pacs.008.001.07 Adds Building Name to Name and Address Requires LEI (Legal Entity Identifier) Personal Identifiers (date and place of birth, NINo, passport #) Purpose codes Remittance information either structured, unstructured, or related (external reference), allowing some extended Latin characters., Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 20

  21. ISO 20022 Universal Financial Industry Message Scheme summer school summer school ISO 20022 Defines a methodology to defining messages for financial services Repository Model - UML profile of business and message items. Messages as XML, or ASN.1, with JSON being proposed on the side. Groups RA = Registration Authority manages repository. RMG = Registration Management Group manages process. TSG = Technical Support Group advisory technology specialists. SEG = Standards Evaluation Group deciding specialists in each business area. eg. Payments SEG Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 21

  22. ISO20022.org summer school summer school Model Driven Architecture Business Components get realised as Message Components that are reusable across messages. Eg. Address These generate physical outputs including XML Schema The data item names are abbreviated for XML. eg. MsgId , Nm , Strd , https://www.iso20022.org/ Has the Financial Repository and catalogues for each business domain, and supporting information. Messages are documented with XML Schema MDRs Message Definition Reports MUG Message Usage Guidelines Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 22

  23. pacs.008 Customer Credit Transfer summer school summer school The FinancialInstitutionToFinancialInstitutionCustomerCreditTransfer message is sent by the debtor agent to the creditor agent, directly or through other agents and/or a payment clearing and settlement system. It is used to move funds from a debtor account to a creditor. (Payments Clearing and Settlement MDR 2018) ISO 20022 pacs.008.001.07 FIToFICustomerCreditTransferV0n_pacs.008.001.07 https://www.iso20022.org/payments_messages.page https://www.iso20022.org/sites/default/files/documents/messages/pacs/schemas/pacs.007.001.08.xsd https://www.iso20022.org/sites/default/files/documents/general/ISO20022_MDR_PaymentsClearingAndSettleme nt_2017_2018.zip Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 23

  24. Pacs.008 Example XML (1) summer school summer school On receipt of the payment instruction, BBBB Bank debits AAAA Bank account, deducts its processing charges and sends an FIToFICustomerCreditTransfer to CCCC Bank, Dublin across the Irish RTGS system. <FIToFICstmrCdtTrf> <GrpHdr> <MsgId>BBBB/151109-CBJO56</MsgId> <CreDtTm>2015-11- 09T10:13:00</CreDtTm> <NbOfTxs>1</NbOfTxs> <SttlmInf> <SttlmMtd>CLRG</SttlmMtd> <ClrSys> <Prtry>CBJ</Prtry> </ClrSys> </SttlmInf> <InstgAgt> <FinInstnId> <BICFI>BBBBIE2D</BICFI> </FinInstnId> </InstgAgt> <InstdAgt> <FinInstnId> <BICFI>CCCCIE2D</BICFI> </FinInstnId> </InstdAgt> </GrpHdr> <CdtTrfTxInf> <PmtId> <InstrId>BBBB/151109/- CBJ056/1</InstrId> <EndToEndId>CROPS/SX-25T/2015- 10-13</EndToEndId> <TxId>AAAA/151109- CCT/EUR/443/1</TxId> </PmtId> <IntrBkSttlmAmt Ccy="EUR">74900</IntrBkSttlmAmt> <IntrBkSttlmDt>2015-11- 09</IntrBkSttlmDt> <InstdAmt Ccy="EUR">75000</InstdAmt> Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 24

  25. Pacs.008 Example XML (2) summer school summer school On receipt of the payment instruction, BBBB Bank debits AAAA Bank account, deducts its processing charges and sends an FIToFICustomerCreditTransfer to CCCC Bank, Dublin across the Irish RTGS system. <PstlAdr> <StrtNm>Corn Street</StrtNm> <BldgNb>13</BldgNb> <PstCd>W6 8DR</PstCd> <TwnNm>London</TwnNm> <Ctry>GB</Ctry> </PstlAdr> </Dbtr> <DbtrAcct> <Id> <Othr> <Id>46373892034012</Id> </Othr> </Id> </DbtrAcct> <DbtrAgt> <FinInstnId> <BICFI>AAAAGB2L</BICFI> </FinInstnId> </DbtrAgt> <ChrgBr>SHAR</ChrgBr> <ChrgsInf> <Amt Ccy="EUR">100</Amt> <Agt> <FinInstnId> <BICFI>BBBBIE2D</BICFI> </FinInstnId> </Agt> </ChrgsInf> <UltmtDbtr> <Nm>Biogenetics - CROPS</Nm> <PstlAdr> <StrtNm>Growth Street</StrtNm> <BldgNb>17</BldgNb> <PstCd>G5 OTW</PstCd> <TwnNm>Glasgow</TwnNm> <Ctry>GB</Ctry> </PstlAdr> </UltmtDbtr> <Dbtr> <Nm>Biogenetics - HQ</Nm> Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 25

  26. Pacs.008 Example XML (3) summer school summer school On receipt of the payment instruction, BBBB Bank debits AAAA Bank account, deducts its processing charges and sends an FIToFICustomerCreditTransfer to CCCC Bank, Dublin across the Irish RTGS system. <CdtrAgt> <FinInstnId> <BICFI>CCCCIE2D</BICFI> </FinInstnId> </CdtrAgt> <Cdtr> <Nm>SeedInc.</Nm> <PstlAdr> <StrtNm>Grain Lane</StrtNm> <BldgNb>27</BldgNb> <TwnNm>Dublin</TwnNm> <Ctry>IE</Ctry> </PstlAdr> </Cdtr> <CdtrAcct> <Id> <IBAN>IE29CCCC93115212345678</IBAN> </Id> </CdtrAcct> <Purp> <Cd>GDDS</Cd> </Purp> <RmtInf> <Strd> <RfrdDocInf> <Tp> <CdOrPrtry> <Cd>CINV</Cd> </CdOrPrtry> </Tp> <Nb>SX-25T</Nb> <RltdDt>2015-10-13</RltdDt> </RfrdDocInf> </Strd> </RmtInf> </CdtTrfTxInf> </FIToFICstmrCdtTrf> Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 26

  27. ISO 20022 and JSON summer school summer school ISO 20022 and JSON: An Implementation Best Practices Whitepaper https://www.iso20022.org/sites/default/files/documents/general/ISO20022_API_JSON_Whitepaper_Final_20180129.pdf Describes web service features such as URI usage. ie. https://{host}/{service}/{version}/{resource_path}?{parameters} JSON Schema transformation rules From the Logical level to Physcal level as JSON Schema (draft 4) Converting ISO 20022 XML into JSON Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 27

  28. Converting ISO 20022 XML into JSON summer school summer school As the ISO 20022 XML is generated from a model, only a few XSD features are used in a regular way. (e.g. There is no mixed content.) Create a JSON Object with an @xmlns property set to the ISO 20022 message s namespace. Recursively descend the XML Document element: Elements with maxOccurs > 1 (or unbounded), become a single property named as element, having an array holding representations of each element s children. Elements with maxOccurs = 1, become a single property named as element, whose value is a representations of the element s children. The representation of an element s children, in the case of an Each attribute becomes a property prefixed with @. Element of simple content, without attributes, is just the value. Element of simple content, with attributes, is an object with properties for attributes, and a property $ set to its value. Other Elements, is an object with properties for attributes and a property for each distinct child element name. Value Types a. XML Booleans become JSON Booleans. b. All other data type values become strings JSON numbers are not used, because JSON parsers do not have a standard decimal precision for numbers. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 28

  29. Financial Services - XML & JSON APIs jason-polis@json.plus Pacs.008 Example as JSON summer school summer school {"@xmlns" : "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.07" ,"FIToFICstmrCdtTrf": {"@xmlns" : "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.07" ,"FinancialInstitutionToFinancialInstitut ionCustomerCreditTransfer": {"GroupHeadrr": {"MessageId":"BBBB/151109-CBJO56" ,"CreatedDateTime": "2015-11-09T10:13:00" ... ,"InstructedAmount": {"@Currency":"EUR" ,"$":"75000"} ... {"GrpHdr": {"MsgId":"BBBB/151109-CBJO56" ,"CreDtTm": "2015-11-09T10:13:00" ... ,"InstdAmt": {"@Ccy":"EUR" ,"$":"75000"} ... Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 29

  30. Converting ISO 20022 XML into JSON - Comments and questions summer school summer school Comments This conversion requires: Knowledge of maxOccurs from the schema, which isn t available in the PSVI Lookups from the abbreviation to the full name of elements and attributes Usually the value is in a property named for the element, and sometimes a property $ . Attributes are used just for currencies. Eg. <InstdAmt ccy= GBP >1234.56</InstdAmt> InstructedAmount : { @ccy : GBP , $ : 1234.56 } Questions (Open Issues) Mostly around how JSON Schema would represent namespace, namespace prefix, facets, date-time format, IDREF. Should the namespace of the JSON and XML documents be the same ? Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 30

  31. Financial Services - XML & JSON APIs jason-polis@json.plus FPML Financial Products Markup Language summer school summer school For the processing of financial derivatives such as options and swaps. <dataDocument xmlns="http://www.fpml.org/FpML-5/confirmation" ... <paymentAmount> <currency>GBP</currency> <amount>10000000</amount> </paymentAmount> Uses a great many xsd features including element and type substitution, {"dataDocument": {"xmlns": "http://www.fpml.org/FpML-5/confirmation", ... ,"paymentAmount: {"currency":"GBP" ,"amount":"10000000" } } Uses at least one of schema pattern Large. <paymentAmount> <currency currencyScheme="http://www.fpml.org/coding- scheme/external/iso4217-2001-08-15" >GBP</currency> <amount>10000000</amount> </paymentAmount> As schema valid FPML disallows mixed content, elements contain either text or elements or nothing, with or without attributes. ,"paymentAmount: {"currency": {"currencyScheme":"http://www.fpml.org/coding- scheme/external/iso4217-2001-08-15" ,"$":"GBP" ,"amount":"10000000" } } Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 31

  32. Financial Services - XML & JSON APIs jason-polis@json.plus FPML XML to JSON summer school summer school Each element which may recur are represented as member whose value is an array of contents, a single element as member with just the contents. The representation of the content of each element when the element has no content, and its type allows elements, is an empty object {} Element with maxOccurs > 1 represented as array of the content of each element. element-name :[element-content, ] has no content, and its type allows text, is an empty string Element with maxOccurs = 1 represented as just the content. element-name :element-content has a value and no attribute, is just the value value has a value and attributes is the value in a $ member, and a member for each attribute. { $ : value, attribute-name : attribute-value } The representation of values for both elements and attributes is has elements and child elements. { child-element-name :child-element-contents, } is a member for each attribute xsd:boolean or similar is a json:boolean xsd:decimal or similar is a json:number has no content and its type is numeric or boolean invalid fpml. Elements of these types must contain a value. other is a json:text this include dates and code lists (enumerations) nil invalid fpml. Fpml doesn t allow nillable content. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 32

  33. FPML XML to JSON - Comments and questions summer school summer school Comments Similarly to the proposed ISO 20022 conversion, this conversion requires: Knowledge of maxOccurs from the schema, which isn t available in the PSVI Knowledge of whether the node s type is a numeric type. (However , no name Lookups this time as FPML keep readable names.) Usually the value is in a property named for the element, and sometimes a property $ . However there are many optional attributes in FPML, so might have to code for both. Eg. <accountId accountIdScheme= SCA >1236-1238</accountId> accountId : { @accountIdScheme : SCA , $ : 1236-1238 } Eg. <accountId>1236-1238</accountId> accountId : 1236-1238 JSON libraries handle large numbers in different ways. We need precision. Questions Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 33

  34. General Issues with XML to JSON summer school summer school The conversions presented so far present nice looking JSON, but are lossy and not reversible. Document Order In particular, a pain point has been the retrieval of FPML as XML, stored as JSON/BSON on big data bases. When converted from BSON to XML, the document order isn t preserved so the documents are schema-invalid. This also makes it difficult to do textual comparison. Documents vs Objects Mixed content is not well handled by typical conversions. When a big data schema is used, the type of the contents often ends up being any as the root class for text and numbers. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 34

  35. Financial Services - XML & JSON APIs jason-polis@json.plus Other Approaches summer school summer school Experiences with JSON and XML Transformations Badgerfish https://www.w3.org/2011/10/integration- workshop/s/ExperienceswithJSONandXMLTransformations. v08.pdf http://www.sklar.com/badgerfish/ elements:[element, ] Typical JSON and XML Mapping Issues element: {$:text, @attr:value, } Round-Trippability Known issues: Friendliness Munges multiple text nodes. A Use Case The FPML and ISO 20022 conversions are similar to Approach #3 XML to Friendly JSON JsonML JSON and XML Conversion http://www.jsonml.org/ http://wiki.open311.org/JSON_and_XML_Conversion/ [ element-name , { attributes }, content ] Good comparison site ie. square s-expresssions Many links now stale. Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 35

  36. Financial Services - XML & JSON APIs jason-polis@json.plus json+ , yet another approach summer school summer school json+metadata json+psvi Generic approach position 0 for metadata json+metadata for XML PSVI { name : [ metadata , content ] } { element : [ [{PSVI}, attributes ] , content ]} attributes = [ {attribute:[{PSVI},value]}, ] json+xml Preserves document order of attributes json+metadata for XML { element-name : [ { attribute:value, }, content ] } Useful as intermediate format to bring PSVI into JSON, such as xsi:type. Preserves document order of element content Similar to JSONML. Is there any further mileage in this ? Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 36

  37. Financial Services - XML & JSON APIs jason-polis@json.plus Next Steps summer school summer school Feedback Use cases Tools Examples Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 37

  38. Financial Services - XML & JSON APIs Wednesday12th September 2018 summer school Financial Services - XML & JSON APIs Jason Polis jason.polis@json.plus Jason Polis : Financial Services - XML & JSON APIs Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International License xmlsummerschool.com Slide 38

More Related Content