Preserve Michelson literals when serializing Micheline JSON
A generic JSON converter can silently round an on-chain integer or add a hexadecimal prefix to a byte literal. Micheline has its own node forms for both values.
Round-trip a boundary case
Serialize the pair below and parse it through the same pipeline used for contract calls. The decimal integer is larger than JavaScript’s safe integer range. Preserve its string representation throughout the conversion.
{"prim":"Pair","args":[{"int":"9007199254740993"},{"bytes":"00ff"}]}
The bytes node contains four hex characters for two bytes. The leading zero is significant. Treating it as an integer would drop the first byte and change the contract input.
Validate syntax and type independently
A structurally valid Micheline tree can still have the wrong Michelson type or field order for an entrypoint. Check the target parameter type after validating serialization. Preserve annotations when the application uses them to resolve named entrypoints or fields. octez.tezos.com Octez protocol documentation