✓tick.pro

JSON Date Handling — API Serialization Guide | tick.pro

Guide to handling dates in JSON APIs. ISO 8601 vs Unix timestamps vs JSON.stringify behavior and best practices.

JSON Date Best Practices

ISO 8601 String (Recommended)
{"createdAt": "2024-01-15T10:30:00Z"}
Unix Timestamp (Seconds)
{"createdAt": 1705312200}
Unix Timestamp (Milliseconds)
{"createdAt": 1705312200000}

JavaScript JSON.stringify

JSON.stringify(new Date())

Returns ISO 8601 string automatically

Frequently Asked Questions

How should I represent dates in JSON?

Use ISO 8601 strings (e.g., "2024-01-15T10:30:00Z") for human readability, or Unix timestamps (seconds or milliseconds) for compact representation.

curl https://tick.pro/formats/json-date