Developer Guides

Work through common problems with timestamps, exported data and browser API requests.

Diagnose a timestamp unit mismatch

The instant 2024-01-01T00:00:00Z is 1704067200 seconds or 1704067200000 milliseconds from the Unix epoch. A value accidentally read in milliseconds can put a modern event in January 1970. Check the unit in the source API or database schema first.

new Date(1704067200 * 1000).toISOString()           // JavaScript
datetime.fromtimestamp(1704067200, tz=timezone.utc) // Python, import datetime and timezone
Instant.ofEpochSecond(1704067200L)                  // Java
SELECT to_timestamp(1704067200);                    -- PostgreSQL

Check the UTC result in the Unix Timestamp Converter, then select the timezone in which the event was recorded. Use an explicit unit for short or historical timestamps.

Prepare nested JSON for a spreadsheet

Decide what one row represents before exporting. For an API response like {"items":[{"id":7,"owner":{"name":"Lee"}}]}, extract $.items with the JSONPath Tester. Use the array result in the JSON to CSV Converter with flattening enabled.

id,owner.name
7,Lee

An array nested in an individual row remains a JSON value in one field. If a report needs one row per array element, reshape the array before exporting. Import identifiers as text in the spreadsheet when leading zeroes matter, and treat externally supplied values as text.

Diagnose a request that works in cURL

Start with a GET to an endpoint you control and compare the status, response headers and body. If the browser API Tester reports a network error while cURL returns a response, check the browser console for CORS details and the Network panel for an OPTIONS preflight.

Compare the request origin, method and headers with the server's allowed origins, methods and headers. Use an explicit origin when credentials are required. Check DNS and TLS separately when there is no response in either client.

Compare JSON response changes before a release

Save representative responses for the same request on both builds. Use the JSON Compare tool to check value and type changes separately from indentation and object key order.

Before: {"total":3,"items":["a","b","c"]}
After:  {"items":["a","b","c"],"total":"3"}

The item order stayed the same. The total changed from a number to a string, which can break a consumer that does arithmetic. When order matters for arrays, keep their original ordering in both samples and check the changed indexes.