JSON to TypeScript
Generate TypeScript interfaces from a sample JSON payload.
Convert a duration between seconds, ISO 8601, clock time and words.
A bare number is read as seconds. 1h 30m, PT1H30M and 01:30:00 all work too.
The Duration Converter reads a length of time however it is written — 5400, "1h 30m", PT1H30M, 01:30:00 — and returns all the others, including the ISO 8601 form that turns up in Kubernetes and XML schemas without ever being explained there.
Enter a duration however it comes — 5400, "1h 30m", PT1H30M, 01:30:00 — and get it in every other form, plus a breakdown into whole units.
The ISO 8601 duration is the one most people meet without being introduced. PT1H30M is one hour and thirty minutes; P1DT2H is one day and two hours; the T separates the date part from the time part, which is what stops the M in P1M (one month) meaning the same as the M in PT1M (one minute). It turns up in Kubernetes manifests, XML schemas, YouTube API responses and JSON schema definitions, and it is rarely explained where it appears.
Both read and written, including the T that separates months from minutes — the commonest mistake in a hand-written one.
A bare number, a written duration, ISO 8601 and clock time, with the reading it chose stated explicitly.
Months and years use conventional averages, because their real length depends on which one you mean — the page says so rather than implying precision.
Weeks, days, hours, minutes, seconds and milliseconds, as well as each total on its own.
"1 hour and 30 minutes", ready to put in an interface.
5400, 1h 30m, PT1H30M or 01:30:00 — all are understood.
The page says which notation it recognised, so a bare number is never silently misread.
Milliseconds, seconds, minutes, hours and days, plus ISO, clock and written forms.
Click any value to take it.
One hour and thirty minutes. P opens the duration, T separates the date part from the time part, and each number is followed by its unit. P1DT2H30M is one day, two hours and thirty minutes.
Because M means months before the T and minutes after it. P1M is one month; PT1M is one minute. Leaving the T out is the commonest mistake in a hand-written ISO duration.
As conventional averages — 30.44 days and 365.25 days — because their real length depends on which month or year you mean. For anything that must be exact, calculate between two actual dates instead.
This reads it as seconds, which is what almost every configuration file means. If you meant milliseconds, add the unit — 5000ms — and the page will say how it read your input either way.
What people who use the Duration Converter think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the Duration Converter. It takes half a minute and no account.
Write the first reviewGenerate TypeScript interfaces from a sample JSON payload.
Generate Java POJOs or records with Jackson annotations from JSON.
Check XML is well-formed and find the exact tag that breaks it.
Serialise a JSON object into a percent-encoded URL query string.
Convert tab-separated data — or a spreadsheet paste — straight into JSON.
Turn a URL query string into structured JSON, including nested and repeated keys.
Reveal tabs, non-breaking spaces and zero-width characters in your text.
Generate the border trick that makes triangles and tooltip arrows.