Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install z3c.json

How to install z3c.json

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install z3c.json
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.5.4
0.5.5Never BuiltWhy not?
0.5.4 Available View build log
Windows (64-bit)
0.5.4
0.5.5Never BuiltWhy not?
0.5.4 Available View build log
Mac OS X (10.5+)
0.5.5 Available View build log
0.5.4 Available View build log
Linux (32-bit)
0.5.5 Available View build log
0.5.4 Available View build log
Linux (64-bit)
0.5.5 Available View build log
0.5.4 Available View build log
 
License
ZPL 2.1
Imports
Lastest release
version 0.5.5 on Feb 28th, 2013

This package provides basic JSON components like JSON reader and writer utilities and a JSON-RPC client proxy including the transport implementation for Zope3.

Detailed Documentation

README

We can use the JSONReader and JSONWriter if we need to convert a data structure to or from JSON syntax -- in other words a EcmaScript mapping object. Let's check the utilities:

>>> import zope.component
>>> from z3c.json import interfaces
>>> from z3c.json import testing
>>> testing.setUpJSONConverter()
JSONWriter Utility
>>> jsonWriter = zope.component.getUtility(interfaces.IJSONWriter)
>>> jsonWriter
<z3c.json.converter.JSONWriter object at ...>

Read some data:

>>> input = {u'a': ['fred', 7],
...          u'b': ['mary', 1.234]}
>>> jsonStr = jsonWriter.write(input)
>>> jsonStr
u'{"a":["fred",7],"b":["mary",1.234]}'
JSONReader Utility
>>> jsonReader = zope.component.getUtility(interfaces.IJSONReader)
>>> jsonReader
<z3c.json.converter.JSONReader object at ...>

Convert the data back to python:

>>> output = jsonReader.read(jsonStr)
>>> output
{u'a': [u'fred', 7], u'b': [u'mary', 1.234]}
>>> input == output
True
CHANGES
0.5.5 (2013-02-26)
  • More informative error message when the server returns an error.
0.5.4 (2010-08-30)
  • Fix my previous SafeBasicAuthTransport refactoring. Tests are still missing for SSL transports.
0.5.3 (2010-08-29)
  • Refactor BasicAuthTransport to reuse as much as possible from Transport that enables to do a simple SafeBasicAuthTransport
0.5.2 (2009-02-24)
  • raise ValueError for mixed parameters on any JSON-RPC version
  • do not test for response len if response is an int
  • fixed possible unicode error in case of response error
  • made all tests pass (JSONWriter inserts no whitespace)
  • added parse_response_headers to allow subclasses to handle header values if needed.
  • Implemented JSON-RPC 2.0 specification. Use JSON-RPC 2.0 version as default. Optional the version 1.0 and 1.1 can be set. See JSON-RPC 2.0 specification for more information.
0.5.1 (2008-01-24)
  • Improved meta-data.
0.5.0 (2008-01-21)
  • Initial Release

Subscribe to package updates

Last updated Feb 28th, 2013

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.