Revisions, exact JSON, and partial results
Most applications should let the decoder detect the revision from tag 65. Inspect that value before interpreting fields whose definitions vary by revision. When an upstream format omits the version, set the decoder's missing-version option and specify the revision you expect. Use an explicit revision override only when you know which schema applies.
| Input | Native aggregate packet decoder | Web packet decoder |
|---|---|---|
| Packet contains tag 65 | Use the default revision mode. | Omit revision and defaultRevision. |
| Packet can omit tag 65 and the producer specifies revision 19 | Set allow_no_version_tag = 1, revision_mode = MISB0601_REVISION_DEFAULT_IF_MISSING, and revision = MISB0601_REVISION_19. | Set allowNoVersion: true, defaultRevision: 'rev19'. |
| Producer requires interpreting the packet as revision 19 | Set revision_mode = MISB0601_REVISION_OVERRIDE and revision = MISB0601_REVISION_19. | Set revision: 'rev19'. |
For tagged JSON on the web, call decoder.decodeJSON(bytes, {keys: 'tagged', iso: false}). This returns JSON text. Use requestJSON when you also need the status and diagnostic.
Use numeric tag keys for interchange, named keys for application objects, and described keys for inspection. Raw timestamp output preserves integer microseconds. For the supplied packet, tag 2 is 9007199254740993. JavaScript rounds this integer when parsing into a Number. Forward or store the text from requestJSON unchanged. If your application needs arithmetic, parse that text with an integer-preserving parser before converting to BigInt.
A malformed frame or invalid checksum can prevent packet decoding. A recoverable field error can leave usable sibling fields. At the native ABI, handle PARTIAL, read the calling thread's diagnostic, consume the populated result, and free it. In Go, inspect the aggregate decode result's Error field. On the web inspect the envelope's status, value, and error. Keep the diagnostic alongside the usable data.
const text = decoder.requestJSON(bytes, {operation: 'packet'});
const {status, error} = JSON.parse(text);
if (status === 'ok' || status === 'partial') saveExactEnvelope(text);
if (error) console.warn(error);
Here saveExactEnvelope is your own storage callback. See web decoder API for the output formats.