def to_json(journal):
 tags = get_tags_count(journal)
 result = {u'tags': dict(((tag, count) for (count, tag) in tags)), u'entries': [e.to_dict() for e in journal.entries]}
 return json.dumps(result, indent=2)

def to_json ( journal ) : tags = get_tags_count ( journal ) result = { u'tags' : dict ( ( ( tag , count ) for ( count , tag ) in tags ) ) , u'entries' : [ e . to_dict ( ) for e in journal . entries ] } return json . dumps ( result , indent = 2 )
convert the value to json .