1

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 ?

asked Dec 21, 2015 at 22:10
2
  • 2
    look at google protobuf ,flat buffers Commented 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! Commented Dec 21, 2015 at 22:21

1 Answer 1

2

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 ...

answered Dec 21, 2015 at 22:15
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Flat buffers suggested by Pradheep looks like it fits that pretty well. Still not sure whether it is 'light' enough for me though.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.