Issue #831 resolved

Make a builtin json tool

Robert Brewer
created an issue

See http://tools.cherrypy.org/wiki/JSON for the output half. This should also possess an input half which checks Content-Type and decodes application/json. Maybe we need a new Toolbox for various media-type-specific tools?

Comments (8)

  1. Anonymous

    Adding it to the core means we add a new dependency on CherryPy. Not such a problem since simplejson is part of the stdlib since Python 2.6 I think but still.

  2. Robert Brewer reporter

    It's written in an independent way--simplejson is only loaded if you turn on the tool and make a request using it. It would be nice if it intelligently detected the "json" stdlib module, though. :)

  3. Anonymous

    r2239 - If the "json" module is available we use that; if not, we look for "simplejson"; if we can't find that either, the library raises !ValueError on the first attempt to use it.

  4. Gustavo Picon

    In r2240:

    fixed json import logic in jsontools to make sure it's only loaded in python >= 2.6 (the python-json package used by sugar installs a json package in 2.5 but it's a complete different thing, making everything fail)

  5. Log in to comment