What data interchange formats can be used for a python and a java application to talk to each other?
I have a python application that will be talking to a Java server. The python application will be sending out simple messages continuously to the java server with a handful of values [ For eg: Name, studentRollNumber, marks ]
I considered having this communication take place in json format since I don't want to get into plain text processing that could potentially be buggy. However, if I use json I'm going to keep transferring the names of the fields [ such as "name", "studentRollNumber" ] etc. multiple times. Is there a better way to do this ?
TL;DR What is a good way to serialize/deserialize an object into text that works in both Java and Python without being too verbose ?
-
2look at google protobuf ,flat buffersPradheep– Pradheep2015年12月21日 22:13:09 +00:00Commented Dec 21, 2015 at 22:13
-
I had heard of protobuf before and had discarded it for some reason (dont remember what). But flat buffers looks really, looking into it now. Thanks!Winnie– Winnie2015年12月21日 22:21:12 +00:00Commented Dec 21, 2015 at 22:21
1 Answer 1
I don't think so.
You seem like you are heading in the right direction when you said .
I don't want to get into plain text processing that could potentially be buggy.
Which is absolutely true and why you should consider formatted text like JSON. And unfortunately any formatting means overhead : increasing the size of the data you are sending.
So you either need to improvise your own format that has the least amount of "extra stuff" in it. Or use the available ones like Json , XML ...