Deterministic and safely JSON.stringify to quickly serialize JavaScript objects
90
Evaluation — 90%
↑ 1.08xAgent success when using this tile
Build a serialization utility for financial transaction records that can handle large monetary values represented as BigInts.
amount: 9007199254740993n (a value beyond JavaScript's safe integer range), it serializes to a JSON string with the amount as a number without throwing an error. @testtimestamp: 1640995200000000000n (a nanosecond timestamp), it serializes to include the timestamp value. @testfee: 2.50) and BigInt amounts (like totalCents: 250000000000000n), both values are included in the serialized output. @test@generates
/**
* Serializes a financial transaction record to a JSON string.
* Handles BigInt values for large amounts and timestamps.
* Produces deterministic output with alphabetically sorted keys.
*
* @param {Object} transaction - The transaction object to serialize
* @returns {string} JSON string representation of the transaction
*/
function serializeTransaction(transaction) {
// IMPLEMENTATION HERE
}
module.exports = { serializeTransaction };Provides JSON serialization with BigInt support and deterministic output.
Install with Tessl CLI
npx tessl i tessl/npm-safe-stable-stringifydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10