Another possible approach to defining data exchange language-independently is Google’s scheme of protocol buffers.
While JSON or JSON-LD are possibilities for encoding sample data and have some major advantages, they are also quite verbose and expensive to exchange. A similar set of challenges have been faced by other in the domain of pervasive computing, and have resulted in binary exchange formats.
Protocol buffers are Google’s approach to a language-independent exchange format. They use a separate interface definition language (IDL) to define message types, coupled with a compiler to build code to marshal and de-marshal messages of these types for exchange on the wire. Messages consist of basic types for which there are straightforward portable encodings (integers of various kinds, real numbers, strings, enumerations), plus constructed types such as records. The protocol buffers compiler can generate marshalling code for common languages (C++, Java, Python).
There are several problems with this for sensor networks. Binary protocols are efficient but inscrutable, and — while protocol buffers are extensible — they remain significantly less flexible that a text-based protocol such as JSON or XML. The compiler would probably need to be at least modified for the Arduino restricted C++ and for Processing client-side. It’s also not clear that the complexity is justified, and there would still be a need for translation to a more pen format for wider exchange.