ekmmeters.py
def jsonRender(self, def_buf):
        """ Translate the passed serial block into string only JSON.

        Args:
            def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.

        Returns:
            str: JSON rendering of meter record.
        """
        try:
            ret_dict = SerialBlock()
            ret_dict[Field.Meter_Address] = self.getMeterAddress()
            for fld in def_buf:
                compare_fld = fld.upper()
                if not "RESERVED" in compare_fld and not "CRC" in compare_fld:
                    ret_dict[str(fld)] = def_buf[fld][MeterData.StringValue]
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))
            return ""
        return json.dumps(ret_dict, indent=4)
def jsonRender(self, def_buf):
        try:
            ret_dict = SerialBlock()
            ret_dict[Field.Meter_Address] = self.getMeterAddress()
            for fld in def_buf:
                compare_fld = fld.upper()
                if not "RESERVED" in compare_fld and not "CRC" in compare_fld:
                    ret_dict[str(fld)] = def_buf[fld][MeterData.StringValue]
        except:
            ekm_log(traceback.format_exc(sys.exc_info()))
            return ""
        return json.dumps(ret_dict, indent=4)
def jsonRender ( self , def_buf ) : try : ret_dict = SerialBlock ( ) ret_dict [ Field . Meter_Address ] = self . getMeterAddress ( ) for fld in def_buf : compare_fld = fld . upper ( ) if not "RESERVED" in compare_fld and not "CRC" in compare_fld : ret_dict [ str ( fld ) ] = def_buf [ fld ] [ MeterData . StringValue ] except : ekm_log ( traceback . format_exc ( sys . exc_info ( ) ) ) return "" return json . dumps ( ret_dict , indent = 4 )
Translate the passed serial block into string only JSON.

        Args:
            def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.

        Returns:
            str: JSON rendering of meter record.
Translate the passed serial block into string only JSON .