I've updated views_json some more:
- Now using 'Content-Type: application/json; charset=utf-8' when setting the HTTP response header.
- 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.
- Now using json_encode() for JSON encoding when not previewing in the Views UI.
- 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.
- Updated some comments.
- Renamed _json_preview_render() to json_encode_formatted().
- Moved the special character encoding code into json_encode_formatted() which removed the need for views_json_encode_special_chars().
Hope you like it !
| Comment | File | Size | Author |
|---|---|---|---|
| views_datasource_20100105.patch | 19.88 KB | icylace |
Comments
Comment #1
allisterbeharry commentedCool will incorporate the changes into the JSON module; after the restructuring your code will have to go to the different, correct places.
Comment #2
icylace commentedThanks. 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.