I've updated views_json some more:

  1. Now using 'Content-Type: application/json; charset=utf-8' when setting the HTTP response header.
  2. In the style options, renamed "coder mode" to "Views API mode" to avoid potential confusion with the Coder module. Views originally using coder mode must be brought up-to-date by activating Views API mode in the style options.
  3. Now using json_encode() for JSON encoding when not previewing in the Views UI.
  4. After looking at the JSON spec again, stopped using views_json_check_label(). The object field labels are defined as normal JSON strings and should be treated as such. views_json_check_label() remains available on its own.
  5. Updated some comments.
  6. Renamed _json_preview_render() to json_encode_formatted().
  7. Moved the special character encoding code into json_encode_formatted() which removed the need for views_json_encode_special_chars().

Hope you like it !

CommentFileSizeAuthor
views_datasource_20100105.patch19.88 KBicylace

Comments

allisterbeharry’s picture

Assigned: Unassigned » allisterbeharry

Cool will incorporate the changes into the JSON module; after the restructuring your code will have to go to the different, correct places.

icylace’s picture

Status: Needs review » Closed (fixed)

Thanks. I just started using the latest dev version (2010-Jan-28) and am blown away by the JSON improvements you put into it. I'm updating my project code now to take advantage of the new stuff. I love the ability to use normal labels for the JSON keys and even more the ability to get ImageCache'd image file paths! So far I just use views_json so I don't know if these improvements are also in its sibling modules. In either case it's truly spectacular. When I get more time I'll work on making a patch for a couple minor things that would be nice to see. I like your refactoring too. You should really consider releasing a beta.