B4J Question Compact/Minify JSON (UBL) string

Solution
Don't confuse the json code generator with the actual json parser.

B4X:
Sub AppStart (Args() As String)
    Download
    StartMessageLoop
End Sub

Private Sub Download
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://docs.oasis-open.org/ubl/UBL-2.1-JSON/v2.0/cnd01/json/UBL-Invoice-2.1-Example.json")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim minimized As String = j.GetString.As(JSON).ToMap.As(JSON).ToCompactString
        Log(minimized)
    End If
    j.Release
    StopMessageLoop
End Sub

This line by itself does all the work:
B4X:
        Dim minimized As String = j.GetString.As(JSON).ToMap.As(JSON).ToCompactString

Map items aren't expected to be in any specific order. Make...

DonManfred

Expert
Licensed User
Longtime User
The json can be parsed by JSON Library
You´ll need to adapt the code to not use any varnames with _ as name though. Or names starting with _ too...

B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim jRoot As Map = parser.NextObject
Dim _A As String = jRoot.Get("_A")
Dim _B As String = jRoot.Get("_B")
Dim Invoice As List = jRoot.Get("Invoice")
For Each colInvoice As Map In Invoice
 Dim TaxTotal As List = colInvoice.Get("TaxTotal")
 For Each colTaxTotal As Map In TaxTotal
  Dim TaxSubtotal As List = colTaxTotal.Get("TaxSubtotal")
  For Each colTaxSubtotal As Map In TaxSubtotal
   Dim TaxAmount As List = colTaxSubtotal.Get("TaxAmount")
   For Each colTaxAmount As Map In TaxAmount
    Dim currencyID As String = colTaxAmount.Get("currencyID")
    Dim _ As Double = colTaxAmount.Get("_")
   Next
   Dim TaxableAmount As List = colTaxSubtotal.Get("TaxableAmount")
   For Each colTaxableAmount As Map In TaxableAmount
    Dim currencyID As String = colTaxableAmount.Get("currencyID")
    Dim _ As Double = colTaxableAmount.Get("_")
   Next
   Dim TaxCategory As List = colTaxSubtotal.Get("TaxCategory")
   For Each colTaxCategory As Map In TaxCategory
    Dim Percent As List = colTaxCategory.Get("Percent")
    For Each colPercent As Map In Percent
     Dim _ As Int = colPercent.Get("_")
    Next
    Dim TaxScheme As List = colTaxCategory.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
    Dim ID As List = colTaxCategory.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
  Next
  Dim TaxAmount As List = colTaxTotal.Get("TaxAmount")
  For Each colTaxAmount As Map In TaxAmount
   Dim currencyID As String = colTaxAmount.Get("currencyID")
   Dim _ As Double = colTaxAmount.Get("_")
  Next
 Next
 Dim AccountingCost As List = colInvoice.Get("AccountingCost")
 For Each colAccountingCost As Map In AccountingCost
  Dim _ As String = colAccountingCost.Get("_")
 Next
 Dim InvoiceLine As List = colInvoice.Get("InvoiceLine")
 For Each colInvoiceLine As Map In InvoiceLine
  Dim TaxTotal As List = colInvoiceLine.Get("TaxTotal")
  For Each colTaxTotal As Map In TaxTotal
   Dim TaxAmount As List = colTaxTotal.Get("TaxAmount")
   For Each colTaxAmount As Map In TaxAmount
    Dim currencyID As String = colTaxAmount.Get("currencyID")
    Dim _ As Double = colTaxAmount.Get("_")
   Next
  Next
  Dim Item As List = colInvoiceLine.Get("Item")
  For Each colItem As Map In Item
   Dim Description As List = colItem.Get("Description")
   For Each colDescription As Map In Description
    Dim languageID As String = colDescription.Get("languageID")
    Dim _ As String = colDescription.Get("_")
   Next
   Dim CommodityClassification As List = colItem.Get("CommodityClassification")
   For Each colCommodityClassification As Map In CommodityClassification
    Dim ItemClassificationCode As List = colCommodityClassification.Get("ItemClassificationCode")
    For Each colItemClassificationCode As Map In ItemClassificationCode
     Dim listID As String = colItemClassificationCode.Get("listID")
     Dim listAgencyID As String = colItemClassificationCode.Get("listAgencyID")
     Dim _ As String = colItemClassificationCode.Get("_")
    Next
   Next
   Dim ClassifiedTaxCategory As List = colItem.Get("ClassifiedTaxCategory")
   For Each colClassifiedTaxCategory As Map In ClassifiedTaxCategory
    Dim Percent As List = colClassifiedTaxCategory.Get("Percent")
    For Each colPercent As Map In Percent
     Dim _ As Int = colPercent.Get("_")
    Next
    Dim TaxScheme As List = colClassifiedTaxCategory.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
    Dim ID As List = colClassifiedTaxCategory.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim SellersItemIdentification As List = colItem.Get("SellersItemIdentification")
   For Each colSellersItemIdentification As Map In SellersItemIdentification
    Dim ID As List = colSellersItemIdentification.Get("ID")
    For Each colID As Map In ID
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim AdditionalItemProperty As List = colItem.Get("AdditionalItemProperty")
   For Each colAdditionalItemProperty As Map In AdditionalItemProperty
    Dim Value As List = colAdditionalItemProperty.Get("Value")
    For Each colValue As Map In Value
     Dim _ As String = colValue.Get("_")
    Next
    Dim Name As List = colAdditionalItemProperty.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim StandardItemIdentification As List = colItem.Get("StandardItemIdentification")
   For Each colStandardItemIdentification As Map In StandardItemIdentification
    Dim ID As List = colStandardItemIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Name As List = colItem.Get("Name")
   For Each colName As Map In Name
    Dim _ As String = colName.Get("_")
   Next
  Next
  Dim InvoicedQuantity As List = colInvoiceLine.Get("InvoicedQuantity")
  For Each colInvoicedQuantity As Map In InvoicedQuantity
   Dim unitCode As String = colInvoicedQuantity.Get("unitCode")
   Dim _ As Int = colInvoicedQuantity.Get("_")
  Next
  Dim LineExtensionAmount As List = colInvoiceLine.Get("LineExtensionAmount")
  For Each colLineExtensionAmount As Map In LineExtensionAmount
   Dim currencyID As String = colLineExtensionAmount.Get("currencyID")
   Dim _ As Int = colLineExtensionAmount.Get("_")
  Next
  Dim AccountingCost As List = colInvoiceLine.Get("AccountingCost")
  For Each colAccountingCost As Map In AccountingCost
   Dim _ As String = colAccountingCost.Get("_")
  Next
  Dim Price As List = colInvoiceLine.Get("Price")
  For Each colPrice As Map In Price
   Dim PriceAmount As List = colPrice.Get("PriceAmount")
   For Each colPriceAmount As Map In PriceAmount
    Dim currencyID As String = colPriceAmount.Get("currencyID")
    Dim _ As Int = colPriceAmount.Get("_")
   Next
   Dim BaseQuantity As List = colPrice.Get("BaseQuantity")
   For Each colBaseQuantity As Map In BaseQuantity
    Dim unitCode As String = colBaseQuantity.Get("unitCode")
    Dim _ As Int = colBaseQuantity.Get("_")
   Next
   Dim AllowanceCharge As List = colPrice.Get("AllowanceCharge")
   For Each colAllowanceCharge As Map In AllowanceCharge
    Dim BaseAmount As List = colAllowanceCharge.Get("BaseAmount")
    For Each colBaseAmount As Map In BaseAmount
     Dim currencyID As String = colBaseAmount.Get("currencyID")
     Dim _ As Int = colBaseAmount.Get("_")
    Next
    Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
    For Each colAllowanceChargeReason As Map In AllowanceChargeReason
     Dim _ As String = colAllowanceChargeReason.Get("_")
    Next
    Dim MultiplierFactorNumeric As List = colAllowanceCharge.Get("MultiplierFactorNumeric")
    For Each colMultiplierFactorNumeric As Map In MultiplierFactorNumeric
     Dim _ As Double = colMultiplierFactorNumeric.Get("_")
    Next
    Dim Amount As List = colAllowanceCharge.Get("Amount")
    For Each colAmount As Map In Amount
     Dim currencyID As String = colAmount.Get("currencyID")
     Dim _ As Int = colAmount.Get("_")
    Next
    Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
    For Each colChargeIndicator As Map In ChargeIndicator
     Dim _ As String = colChargeIndicator.Get("_")
    Next
   Next
  Next
  Dim Note As List = colInvoiceLine.Get("Note")
  For Each colNote As Map In Note
   Dim _ As String = colNote.Get("_")
  Next
  Dim AllowanceCharge As List = colInvoiceLine.Get("AllowanceCharge")
  For Each colAllowanceCharge As Map In AllowanceCharge
   Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
   For Each colAllowanceChargeReason As Map In AllowanceChargeReason
    Dim _ As String = colAllowanceChargeReason.Get("_")
   Next
   Dim Amount As List = colAllowanceCharge.Get("Amount")
   For Each colAmount As Map In Amount
    Dim currencyID As String = colAmount.Get("currencyID")
    Dim _ As Int = colAmount.Get("_")
   Next
   Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
   For Each colChargeIndicator As Map In ChargeIndicator
    Dim _ As String = colChargeIndicator.Get("_")
   Next
  Next
  Dim ID As List = colInvoiceLine.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
  Dim OrderLineReference As List = colInvoiceLine.Get("OrderLineReference")
  For Each colOrderLineReference As Map In OrderLineReference
   Dim LineID As List = colOrderLineReference.Get("LineID")
   For Each colLineID As Map In LineID
    Dim _ As String = colLineID.Get("_")
   Next
  Next
 Next
 Dim UBLVersionID As List = colInvoice.Get("UBLVersionID")
 For Each colUBLVersionID As Map In UBLVersionID
  Dim _ As String = colUBLVersionID.Get("_")
 Next
 Dim DocumentCurrencyCode As List = colInvoice.Get("DocumentCurrencyCode")
 For Each colDocumentCurrencyCode As Map In DocumentCurrencyCode
  Dim listID As String = colDocumentCurrencyCode.Get("listID")
  Dim listAgencyID As String = colDocumentCurrencyCode.Get("listAgencyID")
  Dim _ As String = colDocumentCurrencyCode.Get("_")
 Next
 Dim ContractDocumentReference As List = colInvoice.Get("ContractDocumentReference")
 For Each colContractDocumentReference As Map In ContractDocumentReference
  Dim DocumentType As List = colContractDocumentReference.Get("DocumentType")
  For Each colDocumentType As Map In DocumentType
   Dim _ As String = colDocumentType.Get("_")
  Next
  Dim ID As List = colContractDocumentReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
 Dim AllowanceCharge As List = colInvoice.Get("AllowanceCharge")
 For Each colAllowanceCharge As Map In AllowanceCharge
  Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
  For Each colAllowanceChargeReason As Map In AllowanceChargeReason
   Dim _ As String = colAllowanceChargeReason.Get("_")
  Next
  Dim Amount As List = colAllowanceCharge.Get("Amount")
  For Each colAmount As Map In Amount
   Dim currencyID As String = colAmount.Get("currencyID")
   Dim _ As Int = colAmount.Get("_")
  Next
  Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
  For Each colChargeIndicator As Map In ChargeIndicator
   Dim _ As String = colChargeIndicator.Get("_")
  Next
 Next
 Dim IssueDate As List = colInvoice.Get("IssueDate")
 For Each colIssueDate As Map In IssueDate
  Dim _ As String = colIssueDate.Get("_")
 Next
 Dim PaymentTerms As List = colInvoice.Get("PaymentTerms")
 For Each colPaymentTerms As Map In PaymentTerms
  Dim Note As List = colPaymentTerms.Get("Note")
  For Each colNote As Map In Note
   Dim _ As String = colNote.Get("_")
  Next
 Next
 Dim AccountingSupplierParty As List = colInvoice.Get("AccountingSupplierParty")
 For Each colAccountingSupplierParty As Map In AccountingSupplierParty
  Dim Party As List = colAccountingSupplierParty.Get("Party")
  For Each colParty As Map In Party
   Dim PostalAddress As List = colParty.Get("PostalAddress")
   For Each colPostalAddress As Map In PostalAddress
    Dim StreetName As List = colPostalAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colPostalAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim Department As List = colPostalAddress.Get("Department")
    For Each colDepartment As Map In Department
     Dim _ As String = colDepartment.Get("_")
    Next
    Dim BuildingNumber As List = colPostalAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim CountrySubentityCode As List = colPostalAddress.Get("CountrySubentityCode")
    For Each colCountrySubentityCode As Map In CountrySubentityCode
     Dim _ As String = colCountrySubentityCode.Get("_")
    Next
    Dim Country As List = colPostalAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim listID As String = colIdentificationCode.Get("listID")
      Dim listAgencyID As String = colIdentificationCode.Get("listAgencyID")
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim ID As List = colPostalAddress.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
    Dim CityName As List = colPostalAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colPostalAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim Postbox As List = colPostalAddress.Get("Postbox")
    For Each colPostbox As Map In Postbox
     Dim _ As String = colPostbox.Get("_")
    Next
   Next
   Dim PartyTaxScheme As List = colParty.Get("PartyTaxScheme")
   For Each colPartyTaxScheme As Map In PartyTaxScheme
    Dim CompanyID As List = colPartyTaxScheme.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim TaxScheme As List = colPartyTaxScheme.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim EndpointID As List = colParty.Get("EndpointID")
   For Each colEndpointID As Map In EndpointID
    Dim schemeAgencyID As String = colEndpointID.Get("schemeAgencyID")
    Dim schemeID As String = colEndpointID.Get("schemeID")
    Dim _ As String = colEndpointID.Get("_")
   Next
   Dim PartyLegalEntity As List = colParty.Get("PartyLegalEntity")
   For Each colPartyLegalEntity As Map In PartyLegalEntity
    Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim RegistrationName As List = colPartyLegalEntity.Get("RegistrationName")
    For Each colRegistrationName As Map In RegistrationName
     Dim _ As String = colRegistrationName.Get("_")
    Next
    Dim RegistrationAddress As List = colPartyLegalEntity.Get("RegistrationAddress")
    For Each colRegistrationAddress As Map In RegistrationAddress
     Dim Country As List = colRegistrationAddress.Get("Country")
     For Each colCountry As Map In Country
      Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
      For Each colIdentificationCode As Map In IdentificationCode
       Dim _ As String = colIdentificationCode.Get("_")
      Next
     Next
     Dim CityName As List = colRegistrationAddress.Get("CityName")
     For Each colCityName As Map In CityName
      Dim _ As String = colCityName.Get("_")
     Next
     Dim CountrySubentity As List = colRegistrationAddress.Get("CountrySubentity")
     For Each colCountrySubentity As Map In CountrySubentity
      Dim _ As String = colCountrySubentity.Get("_")
     Next
    Next
   Next
   Dim PartyName As List = colParty.Get("PartyName")
   For Each colPartyName As Map In PartyName
    Dim Name As List = colPartyName.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim Person As List = colParty.Get("Person")
   For Each colPerson As Map In Person
    Dim FamilyName As List = colPerson.Get("FamilyName")
    For Each colFamilyName As Map In FamilyName
     Dim _ As String = colFamilyName.Get("_")
    Next
    Dim FirstName As List = colPerson.Get("FirstName")
    For Each colFirstName As Map In FirstName
     Dim _ As String = colFirstName.Get("_")
    Next
    Dim MiddleName As List = colPerson.Get("MiddleName")
    For Each colMiddleName As Map In MiddleName
     Dim _ As String = colMiddleName.Get("_")
    Next
    Dim JobTitle As List = colPerson.Get("JobTitle")
    For Each colJobTitle As Map In JobTitle
     Dim _ As String = colJobTitle.Get("_")
    Next
   Next
   Dim PartyIdentification As List = colParty.Get("PartyIdentification")
   For Each colPartyIdentification As Map In PartyIdentification
    Dim ID As List = colPartyIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Contact As List = colParty.Get("Contact")
   For Each colContact As Map In Contact
    Dim Telephone As List = colContact.Get("Telephone")
    For Each colTelephone As Map In Telephone
     Dim _ As String = colTelephone.Get("_")
    Next
    Dim Telefax As List = colContact.Get("Telefax")
    For Each colTelefax As Map In Telefax
     Dim _ As String = colTelefax.Get("_")
    Next
    Dim ElectronicMail As List = colContact.Get("ElectronicMail")
    For Each colElectronicMail As Map In ElectronicMail
     Dim _ As String = colElectronicMail.Get("_")
    Next
   Next
  Next
 Next
 Dim AccountingCustomerParty As List = colInvoice.Get("AccountingCustomerParty")
 For Each colAccountingCustomerParty As Map In AccountingCustomerParty
  Dim Party As List = colAccountingCustomerParty.Get("Party")
  For Each colParty As Map In Party
   Dim PostalAddress As List = colParty.Get("PostalAddress")
   For Each colPostalAddress As Map In PostalAddress
    Dim StreetName As List = colPostalAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colPostalAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim Department As List = colPostalAddress.Get("Department")
    For Each colDepartment As Map In Department
     Dim _ As String = colDepartment.Get("_")
    Next
    Dim BuildingNumber As List = colPostalAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim Country As List = colPostalAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim listID As String = colIdentificationCode.Get("listID")
      Dim listAgencyID As String = colIdentificationCode.Get("listAgencyID")
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim ID As List = colPostalAddress.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
    Dim CityName As List = colPostalAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colPostalAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim Postbox As List = colPostalAddress.Get("Postbox")
    For Each colPostbox As Map In Postbox
     Dim _ As String = colPostbox.Get("_")
    Next
    Dim CountrySubentity As List = colPostalAddress.Get("CountrySubentity")
    For Each colCountrySubentity As Map In CountrySubentity
     Dim _ As String = colCountrySubentity.Get("_")
    Next
   Next
   Dim PartyTaxScheme As List = colParty.Get("PartyTaxScheme")
   For Each colPartyTaxScheme As Map In PartyTaxScheme
    Dim CompanyID As List = colPartyTaxScheme.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim TaxScheme As List = colPartyTaxScheme.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim EndpointID As List = colParty.Get("EndpointID")
   For Each colEndpointID As Map In EndpointID
    Dim schemeAgencyID As String = colEndpointID.Get("schemeAgencyID")
    Dim schemeID As String = colEndpointID.Get("schemeID")
    Dim _ As String = colEndpointID.Get("_")
   Next
   Dim PartyLegalEntity As List = colParty.Get("PartyLegalEntity")
   For Each colPartyLegalEntity As Map In PartyLegalEntity
    Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim RegistrationName As List = colPartyLegalEntity.Get("RegistrationName")
    For Each colRegistrationName As Map In RegistrationName
     Dim _ As String = colRegistrationName.Get("_")
    Next
    Dim RegistrationAddress As List = colPartyLegalEntity.Get("RegistrationAddress")
    For Each colRegistrationAddress As Map In RegistrationAddress
     Dim Country As List = colRegistrationAddress.Get("Country")
     For Each colCountry As Map In Country
      Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
      For Each colIdentificationCode As Map In IdentificationCode
       Dim _ As String = colIdentificationCode.Get("_")
      Next
     Next
     Dim CityName As List = colRegistrationAddress.Get("CityName")
     For Each colCityName As Map In CityName
      Dim _ As String = colCityName.Get("_")
     Next
     Dim CountrySubentity As List = colRegistrationAddress.Get("CountrySubentity")
     For Each colCountrySubentity As Map In CountrySubentity
      Dim _ As String = colCountrySubentity.Get("_")
     Next
    Next
   Next
   Dim PartyName As List = colParty.Get("PartyName")
   For Each colPartyName As Map In PartyName
    Dim Name As List = colPartyName.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim Person As List = colParty.Get("Person")
   For Each colPerson As Map In Person
    Dim FamilyName As List = colPerson.Get("FamilyName")
    For Each colFamilyName As Map In FamilyName
     Dim _ As String = colFamilyName.Get("_")
    Next
    Dim FirstName As List = colPerson.Get("FirstName")
    For Each colFirstName As Map In FirstName
     Dim _ As String = colFirstName.Get("_")
    Next
    Dim MiddleName As List = colPerson.Get("MiddleName")
    For Each colMiddleName As Map In MiddleName
     Dim _ As String = colMiddleName.Get("_")
    Next
    Dim JobTitle As List = colPerson.Get("JobTitle")
    For Each colJobTitle As Map In JobTitle
     Dim _ As String = colJobTitle.Get("_")
    Next
   Next
   Dim PartyIdentification As List = colParty.Get("PartyIdentification")
   For Each colPartyIdentification As Map In PartyIdentification
    Dim ID As List = colPartyIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Contact As List = colParty.Get("Contact")
   For Each colContact As Map In Contact
    Dim Telephone As List = colContact.Get("Telephone")
    For Each colTelephone As Map In Telephone
     Dim _ As String = colTelephone.Get("_")
    Next
    Dim Telefax As List = colContact.Get("Telefax")
    For Each colTelefax As Map In Telefax
     Dim _ As String = colTelefax.Get("_")
    Next
    Dim ElectronicMail As List = colContact.Get("ElectronicMail")
    For Each colElectronicMail As Map In ElectronicMail
     Dim _ As String = colElectronicMail.Get("_")
    Next
   Next
  Next
 Next
 Dim PayeeParty As List = colInvoice.Get("PayeeParty")
 For Each colPayeeParty As Map In PayeeParty
  Dim PartyLegalEntity As List = colPayeeParty.Get("PartyLegalEntity")
  For Each colPartyLegalEntity As Map In PartyLegalEntity
   Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
   For Each colCompanyID As Map In CompanyID
    Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
    Dim schemeID As String = colCompanyID.Get("schemeID")
    Dim _ As String = colCompanyID.Get("_")
   Next
  Next
  Dim PartyName As List = colPayeeParty.Get("PartyName")
  For Each colPartyName As Map In PartyName
   Dim Name As List = colPartyName.Get("Name")
   For Each colName As Map In Name
    Dim _ As String = colName.Get("_")
   Next
  Next
  Dim PartyIdentification As List = colPayeeParty.Get("PartyIdentification")
  For Each colPartyIdentification As Map In PartyIdentification
   Dim ID As List = colPartyIdentification.Get("ID")
   For Each colID As Map In ID
    Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
    Dim schemeID As String = colID.Get("schemeID")
    Dim _ As String = colID.Get("_")
   Next
  Next
 Next
 Dim PaymentMeans As List = colInvoice.Get("PaymentMeans")
 For Each colPaymentMeans As Map In PaymentMeans
  Dim PayeeFinancialAccount As List = colPaymentMeans.Get("PayeeFinancialAccount")
  For Each colPayeeFinancialAccount As Map In PayeeFinancialAccount
   Dim FinancialInstitutionBranch As List = colPayeeFinancialAccount.Get("FinancialInstitutionBranch")
   For Each colFinancialInstitutionBranch As Map In FinancialInstitutionBranch
    Dim FinancialInstitution As List = colFinancialInstitutionBranch.Get("FinancialInstitution")
    For Each colFinancialInstitution As Map In FinancialInstitution
     Dim ID As List = colFinancialInstitution.Get("ID")
     For Each colID As Map In ID
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim ID As List = colPayeeFinancialAccount.Get("ID")
   For Each colID As Map In ID
    Dim _ As String = colID.Get("_")
   Next
  Next
  Dim PaymentID As List = colPaymentMeans.Get("PaymentID")
  For Each colPaymentID As Map In PaymentID
   Dim _ As String = colPaymentID.Get("_")
  Next
  Dim PaymentChannelCode As List = colPaymentMeans.Get("PaymentChannelCode")
  For Each colPaymentChannelCode As Map In PaymentChannelCode
   Dim _ As String = colPaymentChannelCode.Get("_")
  Next
  Dim PaymentMeansCode As List = colPaymentMeans.Get("PaymentMeansCode")
  For Each colPaymentMeansCode As Map In PaymentMeansCode
   Dim listID As String = colPaymentMeansCode.Get("listID")
   Dim _ As String = colPaymentMeansCode.Get("_")
  Next
  Dim PaymentDueDate As List = colPaymentMeans.Get("PaymentDueDate")
  For Each colPaymentDueDate As Map In PaymentDueDate
   Dim _ As String = colPaymentDueDate.Get("_")
  Next
 Next
 Dim LegalMonetaryTotal As List = colInvoice.Get("LegalMonetaryTotal")
 For Each colLegalMonetaryTotal As Map In LegalMonetaryTotal
  Dim TaxInclusiveAmount As List = colLegalMonetaryTotal.Get("TaxInclusiveAmount")
  For Each colTaxInclusiveAmount As Map In TaxInclusiveAmount
   Dim currencyID As String = colTaxInclusiveAmount.Get("currencyID")
   Dim _ As Int = colTaxInclusiveAmount.Get("_")
  Next
  Dim LineExtensionAmount As List = colLegalMonetaryTotal.Get("LineExtensionAmount")
  For Each colLineExtensionAmount As Map In LineExtensionAmount
   Dim currencyID As String = colLineExtensionAmount.Get("currencyID")
   Dim _ As Double = colLineExtensionAmount.Get("_")
  Next
  Dim AllowanceTotalAmount As List = colLegalMonetaryTotal.Get("AllowanceTotalAmount")
  For Each colAllowanceTotalAmount As Map In AllowanceTotalAmount
   Dim currencyID As String = colAllowanceTotalAmount.Get("currencyID")
   Dim _ As Int = colAllowanceTotalAmount.Get("_")
  Next
  Dim PrepaidAmount As List = colLegalMonetaryTotal.Get("PrepaidAmount")
  For Each colPrepaidAmount As Map In PrepaidAmount
   Dim currencyID As String = colPrepaidAmount.Get("currencyID")
   Dim _ As Int = colPrepaidAmount.Get("_")
  Next
  Dim ChargeTotalAmount As List = colLegalMonetaryTotal.Get("ChargeTotalAmount")
  For Each colChargeTotalAmount As Map In ChargeTotalAmount
   Dim currencyID As String = colChargeTotalAmount.Get("currencyID")
   Dim _ As Int = colChargeTotalAmount.Get("_")
  Next
  Dim TaxExclusiveAmount As List = colLegalMonetaryTotal.Get("TaxExclusiveAmount")
  For Each colTaxExclusiveAmount As Map In TaxExclusiveAmount
   Dim currencyID As String = colTaxExclusiveAmount.Get("currencyID")
   Dim _ As Double = colTaxExclusiveAmount.Get("_")
  Next
  Dim PayableRoundingAmount As List = colLegalMonetaryTotal.Get("PayableRoundingAmount")
  For Each colPayableRoundingAmount As Map In PayableRoundingAmount
   Dim currencyID As String = colPayableRoundingAmount.Get("currencyID")
   Dim _ As Double = colPayableRoundingAmount.Get("_")
  Next
  Dim PayableAmount As List = colLegalMonetaryTotal.Get("PayableAmount")
  For Each colPayableAmount As Map In PayableAmount
   Dim currencyID As String = colPayableAmount.Get("currencyID")
   Dim _ As Int = colPayableAmount.Get("_")
  Next
 Next
 Dim InvoiceTypeCode As List = colInvoice.Get("InvoiceTypeCode")
 For Each colInvoiceTypeCode As Map In InvoiceTypeCode
  Dim listID As String = colInvoiceTypeCode.Get("listID")
  Dim listAgencyID As String = colInvoiceTypeCode.Get("listAgencyID")
  Dim _ As String = colInvoiceTypeCode.Get("_")
 Next
 Dim Note As List = colInvoice.Get("Note")
 For Each colNote As Map In Note
  Dim languageID As String = colNote.Get("languageID")
  Dim _ As String = colNote.Get("_")
 Next
 Dim OrderReference As List = colInvoice.Get("OrderReference")
 For Each colOrderReference As Map In OrderReference
  Dim ID As List = colOrderReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
 Dim TaxPointDate As List = colInvoice.Get("TaxPointDate")
 For Each colTaxPointDate As Map In TaxPointDate
  Dim _ As String = colTaxPointDate.Get("_")
 Next
 Dim InvoicePeriod As List = colInvoice.Get("InvoicePeriod")
 For Each colInvoicePeriod As Map In InvoicePeriod
  Dim StartDate As List = colInvoicePeriod.Get("StartDate")
  For Each colStartDate As Map In StartDate
   Dim _ As String = colStartDate.Get("_")
  Next
  Dim EndDate As List = colInvoicePeriod.Get("EndDate")
  For Each colEndDate As Map In EndDate
   Dim _ As String = colEndDate.Get("_")
  Next
 Next
 Dim ID As List = colInvoice.Get("ID")
 For Each colID As Map In ID
  Dim _ As String = colID.Get("_")
 Next
 Dim Delivery As List = colInvoice.Get("Delivery")
 For Each colDelivery As Map In Delivery
  Dim ActualDeliveryDate As List = colDelivery.Get("ActualDeliveryDate")
  For Each colActualDeliveryDate As Map In ActualDeliveryDate
   Dim _ As String = colActualDeliveryDate.Get("_")
  Next
  Dim DeliveryLocation As List = colDelivery.Get("DeliveryLocation")
  For Each colDeliveryLocation As Map In DeliveryLocation
   Dim Address As List = colDeliveryLocation.Get("Address")
   For Each colAddress As Map In Address
    Dim StreetName As List = colAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim BuildingNumber As List = colAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim Country As List = colAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim CityName As List = colAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim CountrySubentity As List = colAddress.Get("CountrySubentity")
    For Each colCountrySubentity As Map In CountrySubentity
     Dim _ As String = colCountrySubentity.Get("_")
    Next
   Next
   Dim ID As List = colDeliveryLocation.Get("ID")
   For Each colID As Map In ID
    Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
    Dim schemeID As String = colID.Get("schemeID")
    Dim _ As String = colID.Get("_")
   Next
  Next
 Next
 Dim AdditionalDocumentReference As List = colInvoice.Get("AdditionalDocumentReference")
 For Each colAdditionalDocumentReference As Map In AdditionalDocumentReference
  Dim DocumentType As List = colAdditionalDocumentReference.Get("DocumentType")
  For Each colDocumentType As Map In DocumentType
   Dim _ As String = colDocumentType.Get("_")
  Next
  Dim Attachment As List = colAdditionalDocumentReference.Get("Attachment")
  For Each colAttachment As Map In Attachment
   Dim ExternalReference As List = colAttachment.Get("ExternalReference")
   For Each colExternalReference As Map In ExternalReference
    Dim URI As List = colExternalReference.Get("URI")
    For Each colURI As Map In URI
     Dim _ As String = colURI.Get("_")
    Next
   Next
  Next
  Dim ID As List = colAdditionalDocumentReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
Next
Dim _D As String = jRoot.Get("_D")
 
Upvote 1

aeric

Expert
Licensed User
Longtime User
The json can be parsed by JSON Library
You´ll need to adapt the code to not use any varnames with _ as name though.

B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim jRoot As Map = parser.NextObject
Dim _A As String = jRoot.Get("_A")
Dim _B As String = jRoot.Get("_B")
Dim Invoice As List = jRoot.Get("Invoice")
For Each colInvoice As Map In Invoice
 Dim TaxTotal As List = colInvoice.Get("TaxTotal")
 For Each colTaxTotal As Map In TaxTotal
  Dim TaxSubtotal As List = colTaxTotal.Get("TaxSubtotal")
  For Each colTaxSubtotal As Map In TaxSubtotal
   Dim TaxAmount As List = colTaxSubtotal.Get("TaxAmount")
   For Each colTaxAmount As Map In TaxAmount
    Dim currencyID As String = colTaxAmount.Get("currencyID")
    Dim _ As Double = colTaxAmount.Get("_")
   Next
   Dim TaxableAmount As List = colTaxSubtotal.Get("TaxableAmount")
   For Each colTaxableAmount As Map In TaxableAmount
    Dim currencyID As String = colTaxableAmount.Get("currencyID")
    Dim _ As Double = colTaxableAmount.Get("_")
   Next
   Dim TaxCategory As List = colTaxSubtotal.Get("TaxCategory")
   For Each colTaxCategory As Map In TaxCategory
    Dim Percent As List = colTaxCategory.Get("Percent")
    For Each colPercent As Map In Percent
     Dim _ As Int = colPercent.Get("_")
    Next
    Dim TaxScheme As List = colTaxCategory.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
    Dim ID As List = colTaxCategory.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
  Next
  Dim TaxAmount As List = colTaxTotal.Get("TaxAmount")
  For Each colTaxAmount As Map In TaxAmount
   Dim currencyID As String = colTaxAmount.Get("currencyID")
   Dim _ As Double = colTaxAmount.Get("_")
  Next
 Next
 Dim AccountingCost As List = colInvoice.Get("AccountingCost")
 For Each colAccountingCost As Map In AccountingCost
  Dim _ As String = colAccountingCost.Get("_")
 Next
 Dim InvoiceLine As List = colInvoice.Get("InvoiceLine")
 For Each colInvoiceLine As Map In InvoiceLine
  Dim TaxTotal As List = colInvoiceLine.Get("TaxTotal")
  For Each colTaxTotal As Map In TaxTotal
   Dim TaxAmount As List = colTaxTotal.Get("TaxAmount")
   For Each colTaxAmount As Map In TaxAmount
    Dim currencyID As String = colTaxAmount.Get("currencyID")
    Dim _ As Double = colTaxAmount.Get("_")
   Next
  Next
  Dim Item As List = colInvoiceLine.Get("Item")
  For Each colItem As Map In Item
   Dim Description As List = colItem.Get("Description")
   For Each colDescription As Map In Description
    Dim languageID As String = colDescription.Get("languageID")
    Dim _ As String = colDescription.Get("_")
   Next
   Dim CommodityClassification As List = colItem.Get("CommodityClassification")
   For Each colCommodityClassification As Map In CommodityClassification
    Dim ItemClassificationCode As List = colCommodityClassification.Get("ItemClassificationCode")
    For Each colItemClassificationCode As Map In ItemClassificationCode
     Dim listID As String = colItemClassificationCode.Get("listID")
     Dim listAgencyID As String = colItemClassificationCode.Get("listAgencyID")
     Dim _ As String = colItemClassificationCode.Get("_")
    Next
   Next
   Dim ClassifiedTaxCategory As List = colItem.Get("ClassifiedTaxCategory")
   For Each colClassifiedTaxCategory As Map In ClassifiedTaxCategory
    Dim Percent As List = colClassifiedTaxCategory.Get("Percent")
    For Each colPercent As Map In Percent
     Dim _ As Int = colPercent.Get("_")
    Next
    Dim TaxScheme As List = colClassifiedTaxCategory.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
    Dim ID As List = colClassifiedTaxCategory.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim SellersItemIdentification As List = colItem.Get("SellersItemIdentification")
   For Each colSellersItemIdentification As Map In SellersItemIdentification
    Dim ID As List = colSellersItemIdentification.Get("ID")
    For Each colID As Map In ID
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim AdditionalItemProperty As List = colItem.Get("AdditionalItemProperty")
   For Each colAdditionalItemProperty As Map In AdditionalItemProperty
    Dim Value As List = colAdditionalItemProperty.Get("Value")
    For Each colValue As Map In Value
     Dim _ As String = colValue.Get("_")
    Next
    Dim Name As List = colAdditionalItemProperty.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim StandardItemIdentification As List = colItem.Get("StandardItemIdentification")
   For Each colStandardItemIdentification As Map In StandardItemIdentification
    Dim ID As List = colStandardItemIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Name As List = colItem.Get("Name")
   For Each colName As Map In Name
    Dim _ As String = colName.Get("_")
   Next
  Next
  Dim InvoicedQuantity As List = colInvoiceLine.Get("InvoicedQuantity")
  For Each colInvoicedQuantity As Map In InvoicedQuantity
   Dim unitCode As String = colInvoicedQuantity.Get("unitCode")
   Dim _ As Int = colInvoicedQuantity.Get("_")
  Next
  Dim LineExtensionAmount As List = colInvoiceLine.Get("LineExtensionAmount")
  For Each colLineExtensionAmount As Map In LineExtensionAmount
   Dim currencyID As String = colLineExtensionAmount.Get("currencyID")
   Dim _ As Int = colLineExtensionAmount.Get("_")
  Next
  Dim AccountingCost As List = colInvoiceLine.Get("AccountingCost")
  For Each colAccountingCost As Map In AccountingCost
   Dim _ As String = colAccountingCost.Get("_")
  Next
  Dim Price As List = colInvoiceLine.Get("Price")
  For Each colPrice As Map In Price
   Dim PriceAmount As List = colPrice.Get("PriceAmount")
   For Each colPriceAmount As Map In PriceAmount
    Dim currencyID As String = colPriceAmount.Get("currencyID")
    Dim _ As Int = colPriceAmount.Get("_")
   Next
   Dim BaseQuantity As List = colPrice.Get("BaseQuantity")
   For Each colBaseQuantity As Map In BaseQuantity
    Dim unitCode As String = colBaseQuantity.Get("unitCode")
    Dim _ As Int = colBaseQuantity.Get("_")
   Next
   Dim AllowanceCharge As List = colPrice.Get("AllowanceCharge")
   For Each colAllowanceCharge As Map In AllowanceCharge
    Dim BaseAmount As List = colAllowanceCharge.Get("BaseAmount")
    For Each colBaseAmount As Map In BaseAmount
     Dim currencyID As String = colBaseAmount.Get("currencyID")
     Dim _ As Int = colBaseAmount.Get("_")
    Next
    Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
    For Each colAllowanceChargeReason As Map In AllowanceChargeReason
     Dim _ As String = colAllowanceChargeReason.Get("_")
    Next
    Dim MultiplierFactorNumeric As List = colAllowanceCharge.Get("MultiplierFactorNumeric")
    For Each colMultiplierFactorNumeric As Map In MultiplierFactorNumeric
     Dim _ As Double = colMultiplierFactorNumeric.Get("_")
    Next
    Dim Amount As List = colAllowanceCharge.Get("Amount")
    For Each colAmount As Map In Amount
     Dim currencyID As String = colAmount.Get("currencyID")
     Dim _ As Int = colAmount.Get("_")
    Next
    Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
    For Each colChargeIndicator As Map In ChargeIndicator
     Dim _ As String = colChargeIndicator.Get("_")
    Next
   Next
  Next
  Dim Note As List = colInvoiceLine.Get("Note")
  For Each colNote As Map In Note
   Dim _ As String = colNote.Get("_")
  Next
  Dim AllowanceCharge As List = colInvoiceLine.Get("AllowanceCharge")
  For Each colAllowanceCharge As Map In AllowanceCharge
   Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
   For Each colAllowanceChargeReason As Map In AllowanceChargeReason
    Dim _ As String = colAllowanceChargeReason.Get("_")
   Next
   Dim Amount As List = colAllowanceCharge.Get("Amount")
   For Each colAmount As Map In Amount
    Dim currencyID As String = colAmount.Get("currencyID")
    Dim _ As Int = colAmount.Get("_")
   Next
   Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
   For Each colChargeIndicator As Map In ChargeIndicator
    Dim _ As String = colChargeIndicator.Get("_")
   Next
  Next
  Dim ID As List = colInvoiceLine.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
  Dim OrderLineReference As List = colInvoiceLine.Get("OrderLineReference")
  For Each colOrderLineReference As Map In OrderLineReference
   Dim LineID As List = colOrderLineReference.Get("LineID")
   For Each colLineID As Map In LineID
    Dim _ As String = colLineID.Get("_")
   Next
  Next
 Next
 Dim UBLVersionID As List = colInvoice.Get("UBLVersionID")
 For Each colUBLVersionID As Map In UBLVersionID
  Dim _ As String = colUBLVersionID.Get("_")
 Next
 Dim DocumentCurrencyCode As List = colInvoice.Get("DocumentCurrencyCode")
 For Each colDocumentCurrencyCode As Map In DocumentCurrencyCode
  Dim listID As String = colDocumentCurrencyCode.Get("listID")
  Dim listAgencyID As String = colDocumentCurrencyCode.Get("listAgencyID")
  Dim _ As String = colDocumentCurrencyCode.Get("_")
 Next
 Dim ContractDocumentReference As List = colInvoice.Get("ContractDocumentReference")
 For Each colContractDocumentReference As Map In ContractDocumentReference
  Dim DocumentType As List = colContractDocumentReference.Get("DocumentType")
  For Each colDocumentType As Map In DocumentType
   Dim _ As String = colDocumentType.Get("_")
  Next
  Dim ID As List = colContractDocumentReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
 Dim AllowanceCharge As List = colInvoice.Get("AllowanceCharge")
 For Each colAllowanceCharge As Map In AllowanceCharge
  Dim AllowanceChargeReason As List = colAllowanceCharge.Get("AllowanceChargeReason")
  For Each colAllowanceChargeReason As Map In AllowanceChargeReason
   Dim _ As String = colAllowanceChargeReason.Get("_")
  Next
  Dim Amount As List = colAllowanceCharge.Get("Amount")
  For Each colAmount As Map In Amount
   Dim currencyID As String = colAmount.Get("currencyID")
   Dim _ As Int = colAmount.Get("_")
  Next
  Dim ChargeIndicator As List = colAllowanceCharge.Get("ChargeIndicator")
  For Each colChargeIndicator As Map In ChargeIndicator
   Dim _ As String = colChargeIndicator.Get("_")
  Next
 Next
 Dim IssueDate As List = colInvoice.Get("IssueDate")
 For Each colIssueDate As Map In IssueDate
  Dim _ As String = colIssueDate.Get("_")
 Next
 Dim PaymentTerms As List = colInvoice.Get("PaymentTerms")
 For Each colPaymentTerms As Map In PaymentTerms
  Dim Note As List = colPaymentTerms.Get("Note")
  For Each colNote As Map In Note
   Dim _ As String = colNote.Get("_")
  Next
 Next
 Dim AccountingSupplierParty As List = colInvoice.Get("AccountingSupplierParty")
 For Each colAccountingSupplierParty As Map In AccountingSupplierParty
  Dim Party As List = colAccountingSupplierParty.Get("Party")
  For Each colParty As Map In Party
   Dim PostalAddress As List = colParty.Get("PostalAddress")
   For Each colPostalAddress As Map In PostalAddress
    Dim StreetName As List = colPostalAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colPostalAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim Department As List = colPostalAddress.Get("Department")
    For Each colDepartment As Map In Department
     Dim _ As String = colDepartment.Get("_")
    Next
    Dim BuildingNumber As List = colPostalAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim CountrySubentityCode As List = colPostalAddress.Get("CountrySubentityCode")
    For Each colCountrySubentityCode As Map In CountrySubentityCode
     Dim _ As String = colCountrySubentityCode.Get("_")
    Next
    Dim Country As List = colPostalAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim listID As String = colIdentificationCode.Get("listID")
      Dim listAgencyID As String = colIdentificationCode.Get("listAgencyID")
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim ID As List = colPostalAddress.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
    Dim CityName As List = colPostalAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colPostalAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim Postbox As List = colPostalAddress.Get("Postbox")
    For Each colPostbox As Map In Postbox
     Dim _ As String = colPostbox.Get("_")
    Next
   Next
   Dim PartyTaxScheme As List = colParty.Get("PartyTaxScheme")
   For Each colPartyTaxScheme As Map In PartyTaxScheme
    Dim CompanyID As List = colPartyTaxScheme.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim TaxScheme As List = colPartyTaxScheme.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim EndpointID As List = colParty.Get("EndpointID")
   For Each colEndpointID As Map In EndpointID
    Dim schemeAgencyID As String = colEndpointID.Get("schemeAgencyID")
    Dim schemeID As String = colEndpointID.Get("schemeID")
    Dim _ As String = colEndpointID.Get("_")
   Next
   Dim PartyLegalEntity As List = colParty.Get("PartyLegalEntity")
   For Each colPartyLegalEntity As Map In PartyLegalEntity
    Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim RegistrationName As List = colPartyLegalEntity.Get("RegistrationName")
    For Each colRegistrationName As Map In RegistrationName
     Dim _ As String = colRegistrationName.Get("_")
    Next
    Dim RegistrationAddress As List = colPartyLegalEntity.Get("RegistrationAddress")
    For Each colRegistrationAddress As Map In RegistrationAddress
     Dim Country As List = colRegistrationAddress.Get("Country")
     For Each colCountry As Map In Country
      Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
      For Each colIdentificationCode As Map In IdentificationCode
       Dim _ As String = colIdentificationCode.Get("_")
      Next
     Next
     Dim CityName As List = colRegistrationAddress.Get("CityName")
     For Each colCityName As Map In CityName
      Dim _ As String = colCityName.Get("_")
     Next
     Dim CountrySubentity As List = colRegistrationAddress.Get("CountrySubentity")
     For Each colCountrySubentity As Map In CountrySubentity
      Dim _ As String = colCountrySubentity.Get("_")
     Next
    Next
   Next
   Dim PartyName As List = colParty.Get("PartyName")
   For Each colPartyName As Map In PartyName
    Dim Name As List = colPartyName.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim Person As List = colParty.Get("Person")
   For Each colPerson As Map In Person
    Dim FamilyName As List = colPerson.Get("FamilyName")
    For Each colFamilyName As Map In FamilyName
     Dim _ As String = colFamilyName.Get("_")
    Next
    Dim FirstName As List = colPerson.Get("FirstName")
    For Each colFirstName As Map In FirstName
     Dim _ As String = colFirstName.Get("_")
    Next
    Dim MiddleName As List = colPerson.Get("MiddleName")
    For Each colMiddleName As Map In MiddleName
     Dim _ As String = colMiddleName.Get("_")
    Next
    Dim JobTitle As List = colPerson.Get("JobTitle")
    For Each colJobTitle As Map In JobTitle
     Dim _ As String = colJobTitle.Get("_")
    Next
   Next
   Dim PartyIdentification As List = colParty.Get("PartyIdentification")
   For Each colPartyIdentification As Map In PartyIdentification
    Dim ID As List = colPartyIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Contact As List = colParty.Get("Contact")
   For Each colContact As Map In Contact
    Dim Telephone As List = colContact.Get("Telephone")
    For Each colTelephone As Map In Telephone
     Dim _ As String = colTelephone.Get("_")
    Next
    Dim Telefax As List = colContact.Get("Telefax")
    For Each colTelefax As Map In Telefax
     Dim _ As String = colTelefax.Get("_")
    Next
    Dim ElectronicMail As List = colContact.Get("ElectronicMail")
    For Each colElectronicMail As Map In ElectronicMail
     Dim _ As String = colElectronicMail.Get("_")
    Next
   Next
  Next
 Next
 Dim AccountingCustomerParty As List = colInvoice.Get("AccountingCustomerParty")
 For Each colAccountingCustomerParty As Map In AccountingCustomerParty
  Dim Party As List = colAccountingCustomerParty.Get("Party")
  For Each colParty As Map In Party
   Dim PostalAddress As List = colParty.Get("PostalAddress")
   For Each colPostalAddress As Map In PostalAddress
    Dim StreetName As List = colPostalAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colPostalAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim Department As List = colPostalAddress.Get("Department")
    For Each colDepartment As Map In Department
     Dim _ As String = colDepartment.Get("_")
    Next
    Dim BuildingNumber As List = colPostalAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim Country As List = colPostalAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim listID As String = colIdentificationCode.Get("listID")
      Dim listAgencyID As String = colIdentificationCode.Get("listAgencyID")
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim ID As List = colPostalAddress.Get("ID")
    For Each colID As Map In ID
     Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
    Dim CityName As List = colPostalAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colPostalAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim Postbox As List = colPostalAddress.Get("Postbox")
    For Each colPostbox As Map In Postbox
     Dim _ As String = colPostbox.Get("_")
    Next
    Dim CountrySubentity As List = colPostalAddress.Get("CountrySubentity")
    For Each colCountrySubentity As Map In CountrySubentity
     Dim _ As String = colCountrySubentity.Get("_")
    Next
   Next
   Dim PartyTaxScheme As List = colParty.Get("PartyTaxScheme")
   For Each colPartyTaxScheme As Map In PartyTaxScheme
    Dim CompanyID As List = colPartyTaxScheme.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim TaxScheme As List = colPartyTaxScheme.Get("TaxScheme")
    For Each colTaxScheme As Map In TaxScheme
     Dim ID As List = colTaxScheme.Get("ID")
     For Each colID As Map In ID
      Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
      Dim schemeID As String = colID.Get("schemeID")
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim EndpointID As List = colParty.Get("EndpointID")
   For Each colEndpointID As Map In EndpointID
    Dim schemeAgencyID As String = colEndpointID.Get("schemeAgencyID")
    Dim schemeID As String = colEndpointID.Get("schemeID")
    Dim _ As String = colEndpointID.Get("_")
   Next
   Dim PartyLegalEntity As List = colParty.Get("PartyLegalEntity")
   For Each colPartyLegalEntity As Map In PartyLegalEntity
    Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
    For Each colCompanyID As Map In CompanyID
     Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
     Dim schemeID As String = colCompanyID.Get("schemeID")
     Dim _ As String = colCompanyID.Get("_")
    Next
    Dim RegistrationName As List = colPartyLegalEntity.Get("RegistrationName")
    For Each colRegistrationName As Map In RegistrationName
     Dim _ As String = colRegistrationName.Get("_")
    Next
    Dim RegistrationAddress As List = colPartyLegalEntity.Get("RegistrationAddress")
    For Each colRegistrationAddress As Map In RegistrationAddress
     Dim Country As List = colRegistrationAddress.Get("Country")
     For Each colCountry As Map In Country
      Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
      For Each colIdentificationCode As Map In IdentificationCode
       Dim _ As String = colIdentificationCode.Get("_")
      Next
     Next
     Dim CityName As List = colRegistrationAddress.Get("CityName")
     For Each colCityName As Map In CityName
      Dim _ As String = colCityName.Get("_")
     Next
     Dim CountrySubentity As List = colRegistrationAddress.Get("CountrySubentity")
     For Each colCountrySubentity As Map In CountrySubentity
      Dim _ As String = colCountrySubentity.Get("_")
     Next
    Next
   Next
   Dim PartyName As List = colParty.Get("PartyName")
   For Each colPartyName As Map In PartyName
    Dim Name As List = colPartyName.Get("Name")
    For Each colName As Map In Name
     Dim _ As String = colName.Get("_")
    Next
   Next
   Dim Person As List = colParty.Get("Person")
   For Each colPerson As Map In Person
    Dim FamilyName As List = colPerson.Get("FamilyName")
    For Each colFamilyName As Map In FamilyName
     Dim _ As String = colFamilyName.Get("_")
    Next
    Dim FirstName As List = colPerson.Get("FirstName")
    For Each colFirstName As Map In FirstName
     Dim _ As String = colFirstName.Get("_")
    Next
    Dim MiddleName As List = colPerson.Get("MiddleName")
    For Each colMiddleName As Map In MiddleName
     Dim _ As String = colMiddleName.Get("_")
    Next
    Dim JobTitle As List = colPerson.Get("JobTitle")
    For Each colJobTitle As Map In JobTitle
     Dim _ As String = colJobTitle.Get("_")
    Next
   Next
   Dim PartyIdentification As List = colParty.Get("PartyIdentification")
   For Each colPartyIdentification As Map In PartyIdentification
    Dim ID As List = colPartyIdentification.Get("ID")
    For Each colID As Map In ID
     Dim schemeID As String = colID.Get("schemeID")
     Dim _ As String = colID.Get("_")
    Next
   Next
   Dim Contact As List = colParty.Get("Contact")
   For Each colContact As Map In Contact
    Dim Telephone As List = colContact.Get("Telephone")
    For Each colTelephone As Map In Telephone
     Dim _ As String = colTelephone.Get("_")
    Next
    Dim Telefax As List = colContact.Get("Telefax")
    For Each colTelefax As Map In Telefax
     Dim _ As String = colTelefax.Get("_")
    Next
    Dim ElectronicMail As List = colContact.Get("ElectronicMail")
    For Each colElectronicMail As Map In ElectronicMail
     Dim _ As String = colElectronicMail.Get("_")
    Next
   Next
  Next
 Next
 Dim PayeeParty As List = colInvoice.Get("PayeeParty")
 For Each colPayeeParty As Map In PayeeParty
  Dim PartyLegalEntity As List = colPayeeParty.Get("PartyLegalEntity")
  For Each colPartyLegalEntity As Map In PartyLegalEntity
   Dim CompanyID As List = colPartyLegalEntity.Get("CompanyID")
   For Each colCompanyID As Map In CompanyID
    Dim schemeAgencyID As String = colCompanyID.Get("schemeAgencyID")
    Dim schemeID As String = colCompanyID.Get("schemeID")
    Dim _ As String = colCompanyID.Get("_")
   Next
  Next
  Dim PartyName As List = colPayeeParty.Get("PartyName")
  For Each colPartyName As Map In PartyName
   Dim Name As List = colPartyName.Get("Name")
   For Each colName As Map In Name
    Dim _ As String = colName.Get("_")
   Next
  Next
  Dim PartyIdentification As List = colPayeeParty.Get("PartyIdentification")
  For Each colPartyIdentification As Map In PartyIdentification
   Dim ID As List = colPartyIdentification.Get("ID")
   For Each colID As Map In ID
    Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
    Dim schemeID As String = colID.Get("schemeID")
    Dim _ As String = colID.Get("_")
   Next
  Next
 Next
 Dim PaymentMeans As List = colInvoice.Get("PaymentMeans")
 For Each colPaymentMeans As Map In PaymentMeans
  Dim PayeeFinancialAccount As List = colPaymentMeans.Get("PayeeFinancialAccount")
  For Each colPayeeFinancialAccount As Map In PayeeFinancialAccount
   Dim FinancialInstitutionBranch As List = colPayeeFinancialAccount.Get("FinancialInstitutionBranch")
   For Each colFinancialInstitutionBranch As Map In FinancialInstitutionBranch
    Dim FinancialInstitution As List = colFinancialInstitutionBranch.Get("FinancialInstitution")
    For Each colFinancialInstitution As Map In FinancialInstitution
     Dim ID As List = colFinancialInstitution.Get("ID")
     For Each colID As Map In ID
      Dim _ As String = colID.Get("_")
     Next
    Next
   Next
   Dim ID As List = colPayeeFinancialAccount.Get("ID")
   For Each colID As Map In ID
    Dim _ As String = colID.Get("_")
   Next
  Next
  Dim PaymentID As List = colPaymentMeans.Get("PaymentID")
  For Each colPaymentID As Map In PaymentID
   Dim _ As String = colPaymentID.Get("_")
  Next
  Dim PaymentChannelCode As List = colPaymentMeans.Get("PaymentChannelCode")
  For Each colPaymentChannelCode As Map In PaymentChannelCode
   Dim _ As String = colPaymentChannelCode.Get("_")
  Next
  Dim PaymentMeansCode As List = colPaymentMeans.Get("PaymentMeansCode")
  For Each colPaymentMeansCode As Map In PaymentMeansCode
   Dim listID As String = colPaymentMeansCode.Get("listID")
   Dim _ As String = colPaymentMeansCode.Get("_")
  Next
  Dim PaymentDueDate As List = colPaymentMeans.Get("PaymentDueDate")
  For Each colPaymentDueDate As Map In PaymentDueDate
   Dim _ As String = colPaymentDueDate.Get("_")
  Next
 Next
 Dim LegalMonetaryTotal As List = colInvoice.Get("LegalMonetaryTotal")
 For Each colLegalMonetaryTotal As Map In LegalMonetaryTotal
  Dim TaxInclusiveAmount As List = colLegalMonetaryTotal.Get("TaxInclusiveAmount")
  For Each colTaxInclusiveAmount As Map In TaxInclusiveAmount
   Dim currencyID As String = colTaxInclusiveAmount.Get("currencyID")
   Dim _ As Int = colTaxInclusiveAmount.Get("_")
  Next
  Dim LineExtensionAmount As List = colLegalMonetaryTotal.Get("LineExtensionAmount")
  For Each colLineExtensionAmount As Map In LineExtensionAmount
   Dim currencyID As String = colLineExtensionAmount.Get("currencyID")
   Dim _ As Double = colLineExtensionAmount.Get("_")
  Next
  Dim AllowanceTotalAmount As List = colLegalMonetaryTotal.Get("AllowanceTotalAmount")
  For Each colAllowanceTotalAmount As Map In AllowanceTotalAmount
   Dim currencyID As String = colAllowanceTotalAmount.Get("currencyID")
   Dim _ As Int = colAllowanceTotalAmount.Get("_")
  Next
  Dim PrepaidAmount As List = colLegalMonetaryTotal.Get("PrepaidAmount")
  For Each colPrepaidAmount As Map In PrepaidAmount
   Dim currencyID As String = colPrepaidAmount.Get("currencyID")
   Dim _ As Int = colPrepaidAmount.Get("_")
  Next
  Dim ChargeTotalAmount As List = colLegalMonetaryTotal.Get("ChargeTotalAmount")
  For Each colChargeTotalAmount As Map In ChargeTotalAmount
   Dim currencyID As String = colChargeTotalAmount.Get("currencyID")
   Dim _ As Int = colChargeTotalAmount.Get("_")
  Next
  Dim TaxExclusiveAmount As List = colLegalMonetaryTotal.Get("TaxExclusiveAmount")
  For Each colTaxExclusiveAmount As Map In TaxExclusiveAmount
   Dim currencyID As String = colTaxExclusiveAmount.Get("currencyID")
   Dim _ As Double = colTaxExclusiveAmount.Get("_")
  Next
  Dim PayableRoundingAmount As List = colLegalMonetaryTotal.Get("PayableRoundingAmount")
  For Each colPayableRoundingAmount As Map In PayableRoundingAmount
   Dim currencyID As String = colPayableRoundingAmount.Get("currencyID")
   Dim _ As Double = colPayableRoundingAmount.Get("_")
  Next
  Dim PayableAmount As List = colLegalMonetaryTotal.Get("PayableAmount")
  For Each colPayableAmount As Map In PayableAmount
   Dim currencyID As String = colPayableAmount.Get("currencyID")
   Dim _ As Int = colPayableAmount.Get("_")
  Next
 Next
 Dim InvoiceTypeCode As List = colInvoice.Get("InvoiceTypeCode")
 For Each colInvoiceTypeCode As Map In InvoiceTypeCode
  Dim listID As String = colInvoiceTypeCode.Get("listID")
  Dim listAgencyID As String = colInvoiceTypeCode.Get("listAgencyID")
  Dim _ As String = colInvoiceTypeCode.Get("_")
 Next
 Dim Note As List = colInvoice.Get("Note")
 For Each colNote As Map In Note
  Dim languageID As String = colNote.Get("languageID")
  Dim _ As String = colNote.Get("_")
 Next
 Dim OrderReference As List = colInvoice.Get("OrderReference")
 For Each colOrderReference As Map In OrderReference
  Dim ID As List = colOrderReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
 Dim TaxPointDate As List = colInvoice.Get("TaxPointDate")
 For Each colTaxPointDate As Map In TaxPointDate
  Dim _ As String = colTaxPointDate.Get("_")
 Next
 Dim InvoicePeriod As List = colInvoice.Get("InvoicePeriod")
 For Each colInvoicePeriod As Map In InvoicePeriod
  Dim StartDate As List = colInvoicePeriod.Get("StartDate")
  For Each colStartDate As Map In StartDate
   Dim _ As String = colStartDate.Get("_")
  Next
  Dim EndDate As List = colInvoicePeriod.Get("EndDate")
  For Each colEndDate As Map In EndDate
   Dim _ As String = colEndDate.Get("_")
  Next
 Next
 Dim ID As List = colInvoice.Get("ID")
 For Each colID As Map In ID
  Dim _ As String = colID.Get("_")
 Next
 Dim Delivery As List = colInvoice.Get("Delivery")
 For Each colDelivery As Map In Delivery
  Dim ActualDeliveryDate As List = colDelivery.Get("ActualDeliveryDate")
  For Each colActualDeliveryDate As Map In ActualDeliveryDate
   Dim _ As String = colActualDeliveryDate.Get("_")
  Next
  Dim DeliveryLocation As List = colDelivery.Get("DeliveryLocation")
  For Each colDeliveryLocation As Map In DeliveryLocation
   Dim Address As List = colDeliveryLocation.Get("Address")
   For Each colAddress As Map In Address
    Dim StreetName As List = colAddress.Get("StreetName")
    For Each colStreetName As Map In StreetName
     Dim _ As String = colStreetName.Get("_")
    Next
    Dim AdditionalStreetName As List = colAddress.Get("AdditionalStreetName")
    For Each colAdditionalStreetName As Map In AdditionalStreetName
     Dim _ As String = colAdditionalStreetName.Get("_")
    Next
    Dim BuildingNumber As List = colAddress.Get("BuildingNumber")
    For Each colBuildingNumber As Map In BuildingNumber
     Dim _ As String = colBuildingNumber.Get("_")
    Next
    Dim Country As List = colAddress.Get("Country")
    For Each colCountry As Map In Country
     Dim IdentificationCode As List = colCountry.Get("IdentificationCode")
     For Each colIdentificationCode As Map In IdentificationCode
      Dim _ As String = colIdentificationCode.Get("_")
     Next
    Next
    Dim CityName As List = colAddress.Get("CityName")
    For Each colCityName As Map In CityName
     Dim _ As String = colCityName.Get("_")
    Next
    Dim PostalZone As List = colAddress.Get("PostalZone")
    For Each colPostalZone As Map In PostalZone
     Dim _ As String = colPostalZone.Get("_")
    Next
    Dim CountrySubentity As List = colAddress.Get("CountrySubentity")
    For Each colCountrySubentity As Map In CountrySubentity
     Dim _ As String = colCountrySubentity.Get("_")
    Next
   Next
   Dim ID As List = colDeliveryLocation.Get("ID")
   For Each colID As Map In ID
    Dim schemeAgencyID As String = colID.Get("schemeAgencyID")
    Dim schemeID As String = colID.Get("schemeID")
    Dim _ As String = colID.Get("_")
   Next
  Next
 Next
 Dim AdditionalDocumentReference As List = colInvoice.Get("AdditionalDocumentReference")
 For Each colAdditionalDocumentReference As Map In AdditionalDocumentReference
  Dim DocumentType As List = colAdditionalDocumentReference.Get("DocumentType")
  For Each colDocumentType As Map In DocumentType
   Dim _ As String = colDocumentType.Get("_")
  Next
  Dim Attachment As List = colAdditionalDocumentReference.Get("Attachment")
  For Each colAttachment As Map In Attachment
   Dim ExternalReference As List = colAttachment.Get("ExternalReference")
   For Each colExternalReference As Map In ExternalReference
    Dim URI As List = colExternalReference.Get("URI")
    For Each colURI As Map In URI
     Dim _ As String = colURI.Get("_")
    Next
   Next
  Next
  Dim ID As List = colAdditionalDocumentReference.Get("ID")
  For Each colID As Map In ID
   Dim _ As String = colID.Get("_")
  Next
 Next
Next
Dim _D As String = jRoot.Get("_D")
Yes, I need to replace the variables
e.g "Dim _ As String" to "Dim S_ As String"

The other problem is the API expects the JSON string in correct order. So I have to use B4XOrderedMap to generate the JSON string using StringBuilder.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Don't confuse the json code generator with the actual json parser.

B4X:
Sub AppStart (Args() As String)
    Download
    StartMessageLoop
End Sub

Private Sub Download
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://docs.oasis-open.org/ubl/UBL-2.1-JSON/v2.0/cnd01/json/UBL-Invoice-2.1-Example.json")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim minimized As String = j.GetString.As(JSON).ToMap.As(JSON).ToCompactString
        Log(minimized)
    End If
    j.Release
    StopMessageLoop
End Sub

This line by itself does all the work:
B4X:
        Dim minimized As String = j.GetString.As(JSON).ToMap.As(JSON).ToCompactString

Map items aren't expected to be in any specific order. Make some tests and you will see that it is most likely not an issue.
 
Upvote 1
Solution

aeric

Expert
Licensed User
Longtime User
This is what concern me.
https://sdk.myinvois.hasil.gov.my/types/

Types​

The section contains the definitions of the document structures that APIs can operate within the current version of the MyInvois System.
The solution will support UBL 2.1 standards and would support both JSON and XML as described here UBL-2.1 and here UBL-2.1-JSON-v2.0-cnd01.
Please ensure to follow the right sequence of elements to match UBL 2.1 schema guidance.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Any suggestion how I should construct the Map?
Currently I am doing like this:

B4X:
'Create a List with single item
Public Sub CreateList (Item As Map) As List
    Dim List1 As List
    List1.Initialize
    List1.Add(Item)
    Return List1
End Sub

    Dim colInvoice As Map ' B4XOrderedMap
    colInvoice.Initialize
    colInvoice.Put("ID", CreateList( _
        CreateMap("_": "JSON-INV12345")))
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Here is my code. I see if I can make it more elegant and easier to maintain in the future.

B4X:
Public Sub GenerateInvoiceAsJSON (Compact As String) As String
    Dim colInvoice As Map ' B4XOrderedMap
    colInvoice.Initialize
    colInvoice.Put("ID", CreateList(CreateMap("_": "JSON-INV12345")))
    colInvoice.Put("IssueDate", CreateList(CreateMap("_": "2024-07-23")))
    colInvoice.Put("IssueTime", CreateList(CreateMap("_": "00:30:00Z")))
    colInvoice.Put("InvoiceTypeCode", CreateList(CreateMap("_": "01", "listVersionID": "1.0")))
    colInvoice.Put("DocumentCurrencyCode", CreateList(CreateMap("_": "MYR")))
    colInvoice.Put("TaxCurrencyCode", CreateList(CreateMap("_": "MYR")))
    colInvoice.Put("InvoicePeriod", CreateList(CreateMap( _
                    "StartDate": CreateList(CreateMap("_": "2024-01-01")), _
                    "EndDate": CreateList(CreateMap("_": "2024-07-31")), _
                    "Description": CreateList(CreateMap("_": "Monthly")))))
    colInvoice.Put("BillingReference", CreateList(CreateMap( _
                    "AdditionalDocumentReference": CreateList(CreateMap( _
                    "ID": CreateList(CreateMap("_": "E12345678912")))))))
    colInvoice.Put("AdditionalDocumentReference", CreateList2(Array As Object( _
                    CreateMap( _
                        "ID": CreateList(CreateMap("_": "E12345678912")), _
                        "DocumentType": CreateList(CreateMap("_": "CustomsImportForm"))), _
                    CreateMap( _
                        "ID": CreateList(CreateMap("_": "sa313321312")), _
                        "DocumentType": CreateList(CreateMap("_": "213312dddddd")), _
                        "DocumentDescription": CreateList(CreateMap("_": "asddasdwqfd ddq"))), _
                    CreateMap( _
                        "ID": CreateList(CreateMap("_": "E12345678912")), _
                        "DocumentType": CreateList(CreateMap("_": "K2"))), _
                    CreateMap( _
                        "ID": CreateList(CreateMap("_": "CIF"))))))
    colInvoice.Put("AccountingSupplierParty", CreateList(CreateMap( _
                    "AdditionalAccountID": CreateList(CreateMap( _
                        "_": "CPT-CCN-W-211111-KL-000002", _
                        "schemeAgencyName": "CertEX")), _
                    "Party": CreateList(CreateMap( _
                        "IndustryClassificationCode": CreateList(CreateMap( _
                            "_": "46510", _
                            "name": "Wholesale of computer hardware, software and peripherals")), _
                        "PartyIdentification": CreateList2(Array As Object( _
                            CreateMap("ID": CreateList(CreateMap("_": "Supplier's TIN", "schemeID": "TIN"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "Supplier's BRN", "schemeID": "BRN"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "NA", "schemeID": "SST"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "NA", "schemeID": "TTX"))))), _
                        "PostalAddress": CreateList(CreateMap( _
                            "CityName": CreateList(CreateMap("_": "Kuala Lumpur")), _
                            "PostalZone": CreateList(CreateMap("_": "50480")), _
                            "CountrySubentityCode": CreateList(CreateMap("_": "10")), _
                            "AddressLine": CreateList2(Array As Object( _
                                CreateMap("Line": CreateList(CreateMap("_": "Lot 66"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Bangunan Merdeka"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Persiaran Jaya"))))), _
                            "Country": CreateList(CreateMap( _
                                "IdentificationCode": CreateList(CreateMap( _
                                    "_": "MYS", _
                                    "listID": "ISO3166-1", _
                                    "listAgencyID": "6")))))), _
                        "PartyLegalEntity": CreateList(CreateMap( _
                        "RegistrationName": CreateList(CreateMap("_": "Supplier's Name")))), _
                        "Contact": CreateList(CreateMap( _
                            "Telephone": CreateList(CreateMap("_": "+60-123456789")), _
                            "ElectronicMail": CreateList(CreateMap("_": "supplier@email.com")))))))))
    colInvoice.Put("AccountingCustomerParty", CreateList(CreateMap( _
                    "Party": CreateList(CreateMap( _
                        "PostalAddress": CreateList(CreateMap( _
                            "CityName": CreateList(CreateMap("_": "Kuala Lumpur")), _
                            "PostalZone": CreateList(CreateMap("_": "50480")), _
                            "CountrySubentityCode": CreateList(CreateMap("_": "10")), _
                            "AddressLine": CreateList2(Array As Object( _
                                CreateMap("Line": CreateList(CreateMap("_": "Lot 66"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Bangunan Merdeka"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Persiaran Jaya"))))), _
                            "Country": CreateList(CreateMap( _
                                "IdentificationCode": CreateList(CreateMap( _
                                    "_": "MYS", _
                                    "listID": "ISO3166-1", _
                                    "listAgencyID": "6")))))), _
                        "PartyLegalEntity": CreateList(CreateMap( _
                            "RegistrationName": CreateList(CreateMap("_": "Buyer's Name")))), _
                        "PartyIdentification": CreateList2(Array As Object( _
                            CreateMap("ID": CreateList(CreateMap("_": "Buyer's TIN", "schemeID": "TIN"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "Buyer's BRN", "schemeID": "BRN"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "NA", "schemeID": "SST"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "NA", "schemeID": "TTX"))))), _
                        "Contact": CreateList(CreateMap( _
                            "Telephone": CreateList(CreateMap("_": "+60-123456789")), _   
                            "ElectronicMail": CreateList(CreateMap("_": "buyer@email.com")))))))))
    colInvoice.Put("Delivery", CreateList(CreateMap( _
                    "DeliveryParty": CreateList(CreateMap( _
                        "PartyLegalEntity": CreateList(CreateMap( _
                            "RegistrationName": CreateList(CreateMap("_": "Recipient's Name")))), _
                        "PostalAddress": CreateList(CreateMap( _
                            "CityName": CreateList(CreateMap("_": "Kuala Lumpur")), _
                            "PostalZone": CreateList(CreateMap("_": "50480")), _
                            "CountrySubentityCode": CreateList(CreateMap("_": "10")), _
                            "AddressLine": CreateList2(Array As Object( _
                                CreateMap("Line": CreateList(CreateMap("_": "Lot 66"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Bangunan Merdeka"))), _
                                CreateMap("Line": CreateList(CreateMap("_": "Persiaran Jaya"))))), _
                            "Country": CreateList(CreateMap( _
                                "IdentificationCode": CreateList(CreateMap( _
                                    "_": "MYS", _
                                    "listID": "ISO3166-1", _
                                    "listAgencyID": "6")))))), _
                        "PartyIdentification": CreateList2(Array As Object( _
                            CreateMap("ID": CreateList(CreateMap("_": "Recipient's TIN", "schemeID": "TIN"))), _
                            CreateMap("ID": CreateList(CreateMap("_": "Recipient's BRN", "schemeID": "BRN"))))))), _
                    "Shipment": CreateList(CreateMap( _
                        "ID": CreateList(CreateMap("_": "1234")), _
                            "FreightAllowanceCharge": CreateList(CreateMap( _
                                "ChargeIndicator": CreateList(CreateMap("_": True)), _
                                "AllowanceChargeReason": CreateList(CreateMap("_": "Service charge")), _
                                "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR")))))))))
    colInvoice.Put("PaymentMeans", CreateList(CreateMap( _
                    "PaymentMeansCode": CreateList(CreateMap("_": "03")), _
                    "PayeeFinancialAccount": CreateList(CreateMap( _
                        "ID": CreateList(CreateMap("_": "1234567890123")))))))   
    colInvoice.Put("PaymentTerms", CreateList(CreateMap( _
                    "Note": CreateList(CreateMap("_": "Payment method is cash")))))
    colInvoice.Put("PrepaidPayment", CreateList(CreateMap( _
                    "ID": CreateList(CreateMap("_": "E12345678912")), _
                    "PaidAmount": CreateList(CreateMap("_": 1, "currencyID": "MYR")), _
                    "PaidDate": CreateList(CreateMap("_": "2024-07-23")), _
                    "PaidTime": CreateList(CreateMap("_": "00:30:00Z")))))
    colInvoice.Put("AllowanceCharge", CreateList2(Array As Object( _
                    CreateMap( _
                        "ChargeIndicator": CreateList(CreateMap("_": False)), _
                        "AllowanceChargeReason": CreateList(CreateMap("_": "Sample Description")), _
                        "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR"))), _
                    CreateMap( _
                        "ChargeIndicator": CreateList(CreateMap("_": True)), _
                        "AllowanceChargeReason": CreateList(CreateMap("_": "Service charge")), _
                        "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR"))))))
    colInvoice.Put("TaxTotal", CreateList(CreateMap( _
                    "TaxAmount": CreateList(CreateMap("_": 87.63, "currencyID": "MYR")), _
                    "TaxSubtotal": CreateList(CreateMap( _
                        "TaxableAmount": CreateList(CreateMap("_": 87.63, "currencyID": "MYR")), _
                        "TaxAmount": CreateList(CreateMap("_": 87.63, "currencyID": "MYR")), _
                        "TaxCategory": CreateList(CreateMap( _
                            "ID": CreateList(CreateMap("_": "01")), _
                            "TaxScheme": CreateList(CreateMap( _
                                "ID": CreateList(CreateMap( _
                                    "_": "OTH", _
                                    "schemeID": "UN/ECE 5153", _
                                    "schemeAgencyID": "6")))))))))))
    colInvoice.Put("LegalMonetaryTotal", CreateList(CreateMap( _
                    "LineExtensionAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "TaxExclusiveAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "TaxInclusiveAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "AllowanceTotalAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "ChargeTotalAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "PayableRoundingAmount": CreateList(CreateMap("_": 0.3, "currencyID": "MYR")), _
                    "PayableAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")))))
    colInvoice.Put("InvoiceLine", CreateList(CreateMap( _
                    "ID": CreateList(CreateMap("_": "1234")), _
                    "InvoicedQuantity": CreateList(CreateMap("_": 1, "unitCode": "C62")), _
                    "LineExtensionAmount": CreateList(CreateMap("_": 1436.5, "currencyID": "MYR")), _
                    "AllowanceCharge": CreateList2(Array As Object( _
                        CreateMap( _
                            "ChargeIndicator": CreateList(CreateMap("_": False)), _
                            "AllowanceChargeReason": CreateList(CreateMap("_": "Sample Description")), _
                            "MultiplierFactorNumeric": CreateList(CreateMap("_": 0.15)), _
                            "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR"))), _
                        CreateMap( _
                            "ChargeIndicator": CreateList(CreateMap("_": True)), _
                            "AllowanceChargeReason": CreateList(CreateMap("_": "Sample Description")), _
                            "MultiplierFactorNumeric": CreateList(CreateMap("_": 0.1)), _
                            "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR"))))), _
                    "TaxTotal": CreateList2(Array As Object( _
                        CreateMap( _
                            "TaxAmount": CreateList(CreateMap("_": 1460.5, "currencyID": "MYR")), _
                            "TaxSubtotal": CreateList(CreateMap( _
                                "TaxableAmount": CreateList(CreateMap("_": 1460.5, "currencyID": "MYR")), _
                                "TaxAmount": CreateList(CreateMap("_": 1460.5, "currencyID": "MYR")), _
                                "Percent": CreateList(CreateMap("_": 6)), _
                                "TaxCategory": CreateList(CreateMap("ID": CreateList(CreateMap("_": "E")), _
                                "TaxExemptionReason": CreateList(CreateMap("_": "Exempt New Means of Transport")), _
                                "TaxScheme": CreateList(CreateMap("ID": CreateList(CreateMap("_": "OTH", "schemeID": "UN/ECE 5153", "schemeAgencyID": "6"))))))))))), _
                    "Item": CreateList(CreateMap( _
                        "CommodityClassification": CreateList2(Array As Object( _
                            CreateMap("ItemClassificationCode": CreateList(CreateMap("_": "9800.00.0010", "listID": "PTC"))), _
                            CreateMap("ItemClassificationCode": CreateList(CreateMap("_": "003", "listID": "CLASS"))))), _
                        "Description": CreateList(CreateMap("_": "Laptop Peripherals")), _
                        "OriginCountry": CreateList(CreateMap("IdentificationCode": CreateList(CreateMap("_": "MYS")))))), _
                    "Price": CreateList(CreateMap( _
                        "PriceAmount": CreateList(CreateMap("_": 17, "currencyID": "MYR")))), _
                    "ItemPriceExtension": CreateList(CreateMap( _
                        "Amount": CreateList(CreateMap("_": 100, "currencyID": "MYR")))))))
    
    Dim Invoice As List
    Invoice.Initialize
    Invoice.Add(colInvoice)
    
    Dim OrderedMap As Map 'B4XOrderedMap
    OrderedMap.Initialize
    OrderedMap.Put("_D", "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2")
    OrderedMap.Put("_A", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2")
    OrderedMap.Put("_B", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
    OrderedMap.Put("Invoice", Invoice)

    Pretty = Not(Compact)
    Dim SB As StringBuilder
    SB.Initialize
    SB.Append("{")
    SB.Append(GenerateString(OrderedMap, 0))
    If Pretty Then SB.Append(CRLF)
    SB.Append("}")
    Log(SB.ToString)
    Return SB.ToString
End Sub
 
Upvote 0
Top