Compare JSON Configurations and Debug Five-Field Cron Schedules
Separate key reordering from an actual schedule change, trace day-of-month and weekday matches, and check the timezone before accepting a new configuration.
A reporting job that used to run on Mondays starts sending a second report near the start of each month. The configuration review was a wall of red and green lines because a formatter sorted the keys. To reproduce the problem you need two short pieces of evidence. Find the changed JSON value, then calculate a date on which the old and new schedules disagree. Neither a neatly formatted document nor a successful parse establishes that the job runs when its owner intended.
Reduce a configuration diff to the changed values
Before
{"job":"ledger","schedule":"0 9 * * 1","steps":["collect","send"]}
After
{"steps":["collect","send"],"schedule":"0 9 1 * 1","job":"ledger"}
Paste the two objects into the local JSON diff tool. Both have the same three member names. The order in which an object lists those names has no significance for this comparison. After parsing, the changed value has the path $.schedule. Whitespace outside strings also disappears during parsing. Spaces inside a string remain part of the value. Here the change from an asterisk to the digit one sits inside the schedule string and changes its meaning.
Now reverse the elements of the second steps array and run the comparison again. Arrays have numbered positions. The item at index zero changed from collect to send and the item at index one changed in the opposite direction. If the job runner executes them in order, a report could be sent before its data is collected. A formatter that sorts every array to suppress noise would hide this defect. For arrays that model an unordered collection, compare by a documented stable identifier in a separate review.
There are limits to parsed comparisons. Duplicate member names create ambiguous input and a parser may keep only the last value. Large unquoted integer identifiers can lose precision in a JavaScript number. Preserve exact identifiers as strings at the source. A text comparison of the original files is still valuable when you need to diagnose duplicate keys, numeric spelling or encoding. The tool’s dotted path is a human-readable location. Inspect the actual object if a member name itself contains a dot.
Read the two day fields together
In this five-field dialect the columns are minute, hour, day of month, month and day of week. The example specifies minute zero, hour nine, the first of the month, every month and Monday. When both day fields are restricted, a match in either is sufficient. The scheduled minutes and hours must still match. When day of month is unrestricted, selecting Monday limits the run to Mondays. This distinction explains the extra report without changing any other part of the job.
| Date in UTC | First of month? | Monday? | At 09:00 UTC |
|---|---|---|---|
| Mon 30 Nov 2026 | No | Yes | Both configurations match. |
| Tue 1 Dec 2026 | Yes | No | Only the new configuration matches. |
| Wed 2 Dec 2026 | No | No | Neither matches. |
| Mon 1 Feb 2027 | Yes | Yes | One matching instant for each configuration. |
If the requirement is the first Monday of each month, copying this expression will schedule too many days. In a system that accepts ordinary five-field crontab, one approach is to schedule every Monday and have the job check whether the local day of month is between one and seven before doing the work. That check must use the same business timezone as the scheduler. A more expressive scheduler may support an explicit first-weekday rule. Confirm its syntax before moving an expression between systems.
Write down which clock owns nine o’clock
The visualizer can calculate in UTC or in the browser’s local timezone. The local choice follows the computer running the preview. Your server, CI runner and client may each have a different local zone. To compare a UTC schedule, select UTC in both calculations and retain the starting date. A timestamp with a trailing Z describes a particular instant. “Monday at nine” still needs a timezone before you can compare it with that instant.
For example, 09:00 in New York corresponds to 14:00 UTC during standard time and to 13:00 UTC during daylight time. A job fixed at 14:00 UTC will appear at ten in the morning locally during daylight time. A local clock can also skip a time in spring or repeat it in autumn. Implementations have different policies for missed and repeated runs. Inspect the production scheduler’s documentation and history across a transition before using the preview as an operational prediction.
Include the scheduler dialect in the handoff. Some services put seconds in the first column and others offer special tokens for the last day of a month. Pasting those expressions into a five-field parser either fails immediately or describes an unintended time if someone removes a column. Preserve the original expression in the review alongside any translation.
Read inferred types as questions for the owner
A generated Java record might correctly declare schedule as a string while accepting text that no scheduler can parse. A single sample containing one steps array cannot establish whether the array may be empty, whether elements can be null or whether the key may be absent. The record generator infers an array element type from its first non-null example. Review heterogeneous arrays explicitly. The Java-to-schema tool recognizes supported field and record syntax, but annotations and inherited constraints need independent review.
If the configuration originates in a database export, the SQL-to-JSON tool reads supported INSERT data. It does not query the database or recover triggers, defaults and scheduling rules that were never present in the text. Use one synthetic row to verify the intended column-to-property mapping before comparing the resulting JSON. In a change review, attach the minimal before and after objects, the intended timezone, one newly matching date and one date that must stay excluded. A colleague can then reproduce the discrepancy without a copy of production configuration or credentials.