October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Reconcile Nested ePOS and ERP Data Arrays Natively in the Browser

Match records by business key first, then patch fields. A vendor-neutral browser JavaScript approach using JSON Patch concepts, structuredClone and IndexedDB.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reconcile by key, not by position. Treat the job as two steps: first decide which ePOS record corresponds to which ERP record, then apply field-level changes to matched pairs. A JSON diff or patch only does the second step. It cannot know that an ePOS line item and an ERP line item describe the same sale when they sit at different array positions or carry different identifiers. This guide uses plain browser JavaScript, with no libraries and no vendor-specific assumptions. All payloads below are illustrative, because no ePOS or ERP vendor, schema or policy is specified.

Why positional diffing fails on business arrays

RFC 6902 (JSON Patch) defines a patch as an ordered list of operations applied sequentially, each addressing a location with a JSON Pointer path. Under its equality rules, arrays are equal only if they hold equal values at corresponding positions, while object member order does not matter (RFC 6902). So if the ERP returns the same three order lines in a different order, a purely structural diff reports changes at every index, even though nothing changed in business terms.

As an Amazon Associate I earn from qualifying purchases.

The standard says nothing about ePOS or ERP keys. Aligning records by stable domain identifiers is therefore your responsibility. It is a sound consequence of positional array semantics, not a rule the standard prescribes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not confuse this with the W3C Entity Reconciliation Service API draft. That specification defines a service protocol for matching entities against a data source (W3C draft). It does not merge nested JSON arrays.

#1 Best Overall
Eyoyo EYH2 Handheld USB Wired 2D 1D Barcode Scanner for POS Mobile Payment | Automatic QR Code Scanner PDF417 Data Matrix, Long USB Cable, for Convenience Store, Supermarket, Warehouse
  • Continuous Usage All Day: The EY-H2 USB barcode scanner is designed to always be ready for the next scan, which significantly reduces downtime and repair costs; it shortens checkout lines, improves customer service, and boosts business productivity
  • Plug and Play: Eyoyo wired barcode scanner is connected via a USB cable, with no need to install any driver or software; It offers effortless connection and is compatible with Windows, Mac, Android, and Linux; Seamlessly works with Quickbook, Word, Excel, Novell, and all common software
  • Supports Multiple 1D/2D Barcodes: Eyoyo QR code scanner scan with most 1D 2D barcodes with ease; 1D Barcodes: EAN, UPC, Code 39, Code 93, Code 128, UCC/EAN 128, Codabar, Interleaved 2 of 5, ITF-6, ITF-14, ISBN, ISSN, MSI-Plessey, GS1 Databar, Code 11, Industrial 25, Matrix 2 of 5, etc. 2D Barcodes: QR, DataMatrix, PDF417, and so on
  • Supports Screen Scanning: The Eyoyo 2D scanner is capable of reading barcodes from smartphone screens, such as mobile coupons, digital wallets, and digital loyalty cards; Before scanning, simply turn your screen brightness to the maximum
  • Sturdy Anti-Shock and Durable Design: The Eyoyo 2D barcode scanner features an ergonomic design made of high-quality ABS, enabling it to withstand repeated drops from 5 ft/1.5 m high onto the concrete ground; The durable plastic material ensures a long service life

Decide the rules before writing code

Settle these with whoever owns the integration. The code is trivial once the policy exists.

Decision Options Why it matters
Identity Positional index, or stable business key (for example order ID plus line ID, if both systems guarantee them) Index matching breaks on any reorder, insert or deletion.
Ordering Preserve source order, ignore it, or apply a domain sort Determines whether a reorder is a change at all.
Conflict policy Source precedence, per-field ownership, reject and review, manual choice Decides who wins when values differ.
Auditability Keep originals, log generated operations, surface unresolved keys Lets you explain every change later.
Execution location Browser memory, browser IndexedDB, or a server-side service Browser APIs alone give no access to vendor systems.

A hypothetical example of per-field ownership: the ePOS owns till-transaction facts such as tendered amount and time of sale, while the ERP owns accounting classifications such as ledger code. That is an example policy, not a fact about any product. Apply it only if the integration owner confirms it.

Rank #2
NetumScan Desktop Barcode Scanner, USB QR Code Reader
  • 【Omnidirectional Automatic Barcode scanner】NetumScan Barcode Scanner can easily capture bar codes 1D, 2D/QR on labels, paper, and mobile phone or computer displays,Sensitive and accurately and you can easily scan damaged barcode, distortion barcode, colorful barcode and reflective barcode, etc special barcode. Perfect for retail and other high-volume scanning applications.
  • 【Automatic Smart Sensing Scanning】Specially equipped induction trigger, the desktop barcode scanner support auto-sensing scanning, barcode recognition more intelligent. When you not use the barcode scanner for a while, it will be into a sleeping mode. When handsfree barcode scanner in sleeping mode, it will automatically be activated once the item moving, and read the barcode under the window to upload to your device.
  • 【Non-slip Base and Anti-shock Design】Our Handsfree Omnidirectional Barcode Scanner can be directly placed on the desk, the anti-slip base makes it more stable, Built-in anti-vibration system can avoid damage while falling from the height of 4.92 feet. IP54 technology protects the wireless barcode scanner from dust.
  • 【Improve Your Efficiency】Compared with handheld barcode scanner, our handsfree barcode scanner is more free of your hands, no need to pick up the scanner when scanning, whether it is cashier scanning goods, or customer scanning digital barcode from smart phone. It can improve work efficiency and save time. Also it is so easy to use, no need extra training necessary for new staff.
  • 【Plug and Play, Easy to Use】No need to install any software or app, Our desktop barcode scanner is Plug and play. Easily connected with your laptop, PC, POS by USB Cable. Ideal work for Windows XP/7/8/10, Mac OS, Linux.(Note:NOT compatible with Square/Clover/Shopify.)

Step-by-step implementation

1. Parse and validate shape

Parse both payloads with JSON.parse and check the shape you depend on. Use your systems’ real API documentation to confirm field names, types, nullability, currency units (major units versus minor units), timestamp formats and status codes. Nothing here can be inferred without that documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Normalize only what is known to be equivalent

Convert fields whose equivalence is certain, such as ISO timestamps to a common form or amounts to a single unit. Keep the raw source value beside the normalized one for audit. Do not silently coerce ambiguous values; flag them instead.

Rank #3
Sale
Tera Barcode Scanner Wireless 1D Laser Cordless Barcode Reader with Battery Level Indicator, Versatile 2 in 1 2.4Ghz Wireless and USB 2.0 Wired
  • Larger battery enables longer continuous usage and twice the stand-by time. With the unique battery indicator light showing the remaining battery level, no more Low Battery Anxiety.
  • The curved handle is extended and widened. With specially designed smooth and flat trigger for a better grip.
  • The orange anti shock silicone protective cover can prevent scratches and friction even when dropped from up to 6.56 feet. IP54 technology protects the wireless barcode scanner from dust.
  • Plug and play with the USB receiver or the USB cable, no driver installation needed. Easy and quick to set up. Wireless transmission distance reaches up to 328 ft. in barrier free environment.
  • Supports almost all 1D Barcodes: Febraban Bank Code, Codabar, Code 11, Code93, MSI, Code 128, EAN-128, Code 39, EAN-8, EAN-13, UPC-A, ISBN, Industrial 25, Interleaved 25, Standard 25, Matrix. Reads damaged, fuzzy, reflective and smudged barcodes.
function normalizeLine(src, raw) {
  return {
    key: `${raw.orderId}:${raw.lineId}`,   // assumes both systems guarantee these
    sku: raw.sku,
    qty: Number(raw.qty),
    amountMinor: raw.amountMinor,          // confirm units per system
    _src: src,
    _raw: raw
  };
}

3. Index by business key and catch bad keys

Build a Map per source. Missing and duplicate keys must go to an exceptions list, not be overwritten.

function indexByKey(lines) {
  const map = new Map(), missing = [], duplicates = [];
  for (const l of lines) {
    if (!l.key || l.key.includes('undefined')) { missing.push(l); continue; }
    if (map.has(l.key)) { duplicates.push(l); continue; }
    map.set(l.key, l);
  }
  return { map, missing, duplicates };
}

4. Align and compare field by field

Walk the union of keys. Records present on one side only are additions or omissions for review. Matched pairs get field comparison under the declared precedence.

Rank #4
NetumScan Handheld USB 1D Barcode Scanner with Stand, Wired CCD for POS
  • Please identify the NetumScan merchant, "Flow Dealz" is a faker that sells fake goods.
  • ➤CCD Image Scanning Technology - NetumScan barcode reader is equiped with advanced CCD sensor, which can quick capture 1D codes from paper and screen, including CODE128, UPC/EAN Add on 2 or 5, that can read even deformed barcodes, i.e. smudged, damaged, fuzzy, reflective barcodes, etc. Reading faster and more accurate than laser scanner.
  • ➤Sturdy Anti-shock and Durable Design - Ergonomic design with high-quality ABS making it can support withstand repeated drops from 2m high to the concrete ground, durable to use. Durable plastic material guarantees long service life.
  • ➤Supported 1D Bar Code - 1D Decode Capability: UPC-A, UPC-E, EAN-8, EAN-13, ISSN, ISBN, Code 128, GS1-128, Code39, Code93,Code32, Code11, UCC/EAN128, Interleaved 2 of 5, Industrial 2 of 5, Codabar(NW-7), MSI, Plessey, RSS, China Post, etc.
  • ➤Widely Use Range - This NetumScan Handheld barcode scanner can be used in supermarkets, convenience stores, warehouse, library, bookstore, drugstore, retail shop for file management, inventory tracking and POS(point of sale), etc.
const OWNER = { qty: 'epos', amountMinor: 'epos', ledgerCode: 'erp' }; // hypothetical policy

function reconcile(epos, erp) {
  const result = { matched: [], onlyEpos: [], onlyErp: [], conflicts: [] };
  for (const [k, e] of epos.map) {
    const r = erp.map.get(k);
    if (!r) { result.onlyEpos.push(e); continue; }
    const merged = structuredClone(r._raw);
    for (const [field, owner] of Object.entries(OWNER)) {
      const ev = e._raw[field], rv = r._raw[field];
      if (ev !== rv) {
        if (owner === 'epos') merged[field] = ev;
        result.conflicts.push({ key: k, field, epos: ev, erp: rv, owner });
      }
    }
    result.matched.push({ key: k, merged });
  }
  for (const [k, r] of erp.map) if (!epos.map.has(k)) result.onlyErp.push(r);
  return result;
}

For nested arrays, such as modifiers or tax lines inside a line item, repeat the same pattern recursively with a key appropriate to that level. If a nested array has no stable key, decide explicitly whether to compare it as an unordered set (for example after sorting on a canonical string) or as an opaque value that is replaced whole.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Generate patches only after alignment

Once records are paired, produce either a domain-specific change list or an RFC 6902 patch against the target document. The patch format supports add, remove, replace, move, copy and test operations, applied in order (RFC 6902). Because paths are index-based, compute them from the current position of each matched record. Operations that remove array elements shift later indexes, so emit removals from highest index to lowest, or recompute paths between steps. Adding test operations before replace guards against stale data.

Best Value
NETUM Bluetooth Barcode Scanner, Support 2.4G Wireless & Bluetooth & Wired Connect Smart Phone, Tablet, PC, CCD Bar Code Reader Work with Windows, Mac,Android (NT-1228BC)
  • Widely Compatible: Bluetooth Barcode Scanner for iPhone iPad Android Tablet PC, Support HID / SPP / BLE mode via bluetooth, Work with Windows XP/7/8/10, Mac OS, Windows Mobile, Android OS, iOS, Linux.
  • Strong Recognition Ability: With the 2500 pixels high-resolution CCD sensor Engine, Rapidly decodes all 1D and stacked barcodes (including ISBN book), even worn, damaged or tightly spaced codes. Scan 1D codes directly from paper or screen, such as a computer monitor, smartphone, or tablet, or scan through glass surfaces, plastic shrink wrap, a CCD scanner is likely the best way to go.
  • Automatic Scanning: NT-1228bc barcode scanner have three scanning modes: manual trigger mode, continuous scanning mode and auto-sensing scanning mode. In addition, there is a storage mode. Storage mode can be used when you are out of range of Bluetooth and wireless connectivity. Supports storage of up to 100,000 barcodes. Note: Before use, you need to scan the corresponding setting barcode on the manual.
  • 2600mAh Battery Upgraded: Continuous scanning up to 200,000 times on a full charge. After a full charge the scanner can be used for one month at least, even in warehouses and at pos checkout counters where scanners are frequently used. In libraries and hospitals it can be used even longer.
  • Programmable Configuration: Add custom prefixes/ suffixes, delete characters, Add keyboard keys/ combinations (terminator TAB, CR&LF, Home etc.), Enable or disable the barcode type as you want. Buzzer can be set to mute to allow for a quiet operation.(Note: It does not work with square POS / Divalto / DoorDash / Lightspeed POS system)
const patch = [
  { op: 'test',    path: '/lines/2/qty', value: 3 },
  { op: 'replace', path: '/lines/2/qty', value: 4 }
];

Browsers have no built-in JSON Patch applier, so either write a small one for the operations you actually use or apply the changes directly to your working copy. Dry-run on a copy and review destructive operations (remove, replace of whole subtrees) before anything is written back.

6. Use browser APIs for the working copy and local state

structuredClone() makes an independent deep copy of supported values, which is handy for a scratch copy you can patch safely. It is not a merger or validator, and unsupported values such as functions throw DataCloneError (MDN structuredClone). Parsed JSON is always cloneable.

IndexedDB can persist structured data asynchronously, with transactions and same-origin access (MDN IndexedDB). Use it for things like saving the original payloads and a reconciliation log between sessions. Quotas and eviction vary by browser, so it is not durable integration storage; the system of record must live server-side.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handling exceptions

  • Missing key: quarantine the record and show it to the reviewer; never guess a match.
  • Duplicate key: keep all copies in the exceptions list. Merging them silently can double-count or drop sales.
  • Present on one side only: report as unmatched, and do not delete it from the target automatically.
  • Unit or timestamp ambiguity: leave raw values intact and flag the field.
  • Conflict where neither side is the declared owner: route to manual selection.

Limits of a browser-only approach

This pattern covers the comparison logic only. It does not establish how to authenticate to any vendor, what the schemas look like, which system is the source of truth, or what retention and legal rules apply to transaction data. Browser code also cannot reach vendor APIs unless they permit cross-origin requests or you supply exported files, so confirm that access path with your actual systems first.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.