I found this similar question for converting XML to CSV, which describes a generic XSLT for converting to CSV without knowing the exact XML structure
Assuming the structure is not nested, and I just want essentially key-value pairs inside a root object, is it possible to create a similar XSLT that instead converts to JSON? If so, how?
For example XML
<POSTrans>
<POSDocNo>INV1200004K89</POSDocNo>
<Invoice_Exchange>Invoice</Invoice_Exchange>
<POSDocDate>02/11/2018</POSDocDate>
<POSDocTime>08:06:26 AM</POSDocTime>
<OriginalInvoiceNo></OriginalInvoiceNo>
<StoreNo>12</StoreNo>
<IncrementIDNo>PRD0000003JW</IncrementIDNo>
<BatchNumber>14080487</BatchNumber>
<Medical_Recreational>Recreational</Medical_Recreational>
<RFIDNo>1A400031266EDF4000100487</RFIDNo>
<UOM>G</UOM>
<GrossAmount>11.9500</GrossAmount>
<DiscountAmount>2.9875</DiscountAmount>
<TaxAmount>2.0614</TaxAmount>
<Qty>1.0000</Qty>
<UnitPrice>11.9500</UnitPrice>
<PricingGrade>Value Flower</PricingGrade>
<TotalLines>2</TotalLines>
<LineNo>1</LineNo>
</POSTrans>