############################################################################## # # Copyright (c) 2005 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## # jsoncomponent.py # json implementation component # jwashin 2005-07-27 # 2005-10-09 updated to properly? handle unicode on the boundary # 2005-09-08 updated for modularity and IResult # 2006-05-11 allowed encoding param for reader import minjson as json from interfaces import IJSONReader, IJSONWriter from zope.interface import implements class JSONReader(object): """component implementing JSON reading""" implements(IJSONReader) def read(self,aString,encoding=None): return json.read(aString,encoding) class JSONWriter(object): """component implementing JSON writing""" implements(IJSONWriter) def write(self,anObject): return json.write(anObject)