added jsonify method to create json strings on the fly