This page is for programmers.
You can see the most recent NYT puzzle in JSON format here.
XPF is designed to be a rich, portable, extensible, open data exchange format. JSON, at least in this implementation, has a rigid format which cannot handle unusual puzzle features, although it can completely describe almost any Across Lite puzzle. It can handle complex combinations of circles and rebus, which Across Lite can but the Across Lite text format cannot.
This is similar to XPF.
Note that rebus entries (like "STAR" below) are fully expanded. Display programs can accept the first letter of multi-letter answers as also correct.
Grid numbers are also in a single array reading across rows. 0 means no number.
Note that this gives more flexibility than defining the grid numbers algorithmically. It also makes it easier for display programs to show the grid properly.
Circles are described using another single array reading across. 0 means no circle, 1 means include a circle here. For puzzles without these special indicators, the circles object will be null.
The "clues" section contains two sub-objects named "across" and "down". Each of these is an array of strings. Note these strings contain the grid number as well.
The "answers" section similarly contains two sub-objects named "across" and "down". Each of these is an array of strings. Note that rebus answers like NOSTARCH below are fully expanded.
The "notepad" section is only included if notes exist. It may contain HTML. This website also generates a similar "jnotes" section when appropriate but that would be considered a proprietary extension.
The only special character handling is that the double quote character " is escaped with a preceding blackslash like this: \". My serializer also escapes the forward slash, so dates look like this: 12\/25\/2010.
Server-side programs should use the richer XPF format but for access to this data from a web client through AJAX, JSON could be the best solution.
Sample 1 is a proof of concept only. It uses traditional AJAX to make an asynchronous call to the XWord Info JSON server. A full puzzle grid with grid numbers is displayed, along with Across and Down clues. A real-world implementation would require proxy code on the server to do the cross-domain call. Or rather, a real-world version would probably follow the much simpler Sample 2 pattern.
Sample 2 uses the jQuery library to simplify coding, and JSONP (JSON with Padding) to allow the XWord Info JSON server to be called from any domain. In other words, it is completely self-contained. No server code is required.
Sample 3 shows a simple way to add grids (empty or filled in) to any blog or web site. Once initial setup is done, additional grids can be added with a single line of code. Full details are provided.
Please with your questions or your suggestions for improvement. Thank you.