code: def get_lazystring_encoder(app):
      
      from speaklater import _LazyString
  
      class JSONEncoder(app.json_encoder):
  
          def default(self, o):
              if isinstance(o, _LazyString):
                  return text_type(o)
              return super(JSONEncoder, self).default(o)
  
      return JSONEncoder
docs: Return a JSONEncoder for handling lazy strings from Babel.
  
      Installed on Flask application by default by :class:`InvenioI18N`.