How to convert JSON to protocol buffer in django rest framework

Submitted 1 week, 6 days ago
Ticket #435
Views 22
Language Django
Priority Medium
Status Opened

I am trying to create an api which get an json input and convert it into the protocol buffer,but getting error

Parse() missing 1 required positional argument: 'message

here is the api

class Proto(APIView):

def get(self, request, *args, **kwargs):



"name": "Ashutosh",

"age": "26",

"city": "gurgaon",

"phone_number": "9717336958"


data = str(data)

parsed_data = json.dumps(ast.literal_eval(data))

#message = Parse(json.dumps(parsed_data))

a = google.protobuf.json_format.Parse(parsed_data)

return Response({'status':'SUCCESS','data':"pending...."},status=200)

except Exception as e:

return Response({'status':'ERROR','message':str(e)})

Submitted on Sep 07, 21
add a comment

Wanna Post Ad?
Reach a large group of audience by posting an ad about your business here. For more details
Drop us a Message