code: def mavlink_to_json(msg):
      '''Translate mavlink python messages in json string'''
      ret = '\"%s\": {' % msg._type
      for fieldname in msg._fieldnames:
          data = getattr(msg, fieldname)
          ret += '\"%s\" : \"%s\", ' % (fieldname, data)
      ret = ret[0:-2] + '}'
      return ref mavlink_to_json(msg):
      '''Translate mavlink python messages in json string'''
      ret = '\"%s\": {' % msg._type
      for fieldname in msg._fieldnames:
          data = getattr(msg, fieldname)
          ret += '\"%s\" : \"%s\", ' % (fieldname, data)
      ret = ret[0:-2] + '}'
      return ret
docs: Translate mavlink python messages in json string