HomeDeveloper toolsJSON Array Multiset Difference

JSON Array Multiset Difference

Compare JSON arrays while preserving repeated-value counts.

Processing stays in your browser. This compares multisets rather than sequence positions or stable entity keys. JSON-safe values only, bounded nesting and 5,000 items per array. It does not produce an executable JSON Patch.

How to use the json array multiset difference

Start with the supplied example and review previous array, next array. Replace it with your own data, choose Run tool, and check the result against the method and limits below. Copy or download only after review; edits clear the previous output.

How the tool works

Objects are serialized with recursively sorted keys to compare structural values. Array order within an item remains significant. The output lists only values whose occurrence count changes between the outer arrays.

Worked example

View the example inputs
Previous array
[{"id":1},{"id":1},{"id":2}]
Next array
[{"id":1},{"id":3}]

The default changes {id:1} from two occurrences to one, removes {id:2}, and adds {id:3}.

Good to know

This compares multisets rather than sequence positions or stable entity keys. JSON-safe values only, bounded nesting and 5,000 items per array. It does not produce an executable JSON Patch.

Sources and implementation notes

Implemented by DevBricks Technologies. Method notes updated . References describe the underlying format, method or API. Local processing runs on your device. Any public provider queries are described above and start when you run the lookup.

Work with structured data without losing meaning

Keep a copy of the original document before formatting or converting it. Identify whether the input is one object, an array, or a stream of separate records: these are different structures. JSON uses double quotes for strings and property names, and does not support comments, trailing commas or undefined values. A document that parses successfully can still contain the wrong fields or values for your application.

Inputs and settings explained

Previous array
Paste the previous array as plain text using the demonstrated structure. Keep meaningful line breaks, quotation marks and separators. Start with a small representative example and increase its size only after the output is understood. Read the tool's restrictions before including unsupported syntax or binary data.
See the demonstration value
[{"id":1},{"id":1},{"id":2}]
Next array
Paste the next array as plain text using the demonstrated structure. Keep meaningful line breaks, quotation marks and separators. Start with a small representative example and increase its size only after the output is understood. Read the tool's restrictions before including unsupported syntax or binary data.
See the demonstration value
[{"id":1},{"id":3}]

How to review the result

Compare structure as well as appearance. Check whether numbers stayed numbers, null stayed distinct from an empty string, and arrays retained their order. Very large integers require particular care when a JavaScript number parser is involved; use the representation your receiving system expects. Formatting changes whitespace, whereas conversion between formats can change the available data types. Test the result with the actual consumer before replacing a working configuration or API fixture.

  • Compare a nested object, an empty array and a non-ASCII string with the original.
  • Look for repeated keys, missing required properties and unintended type changes.
  • Validate against your application's schema separately when one is available.

Common questions about this workflow

Does valid JSON mean my API request is correct?

No. Parsing checks the JSON syntax. Your API can still reject an unsupported property, an incorrect type, missing authorization or a value outside its allowed range. Compare the output with the endpoint's documented contract.

What should I do when the input fails?

Start with the smallest failing object. Check the reported location and the preceding line for a missing comma, unmatched quote or bracket. Fix the source rather than deleting data merely to make the parser accept it.

Built by DevBricks Technologies. Found an unexpected result in JSON Array Multiset Difference? Report a reproducible example with the tool URL, settings and a small sample that contains no private information.