Discussion:
"thrift-nicejson": A nicer JSON format for Thrift (now with protocol stack support) release 0.001
Chet Murthy
2017-11-27 22:14:26 UTC
Permalink
[second announcement, b/c now full JSON protocol-stack support works in
C++/Python/Ocaml.]

Folks, I've been working on a "JSON protoco" for Thrift, and it's at a
point where I think it's usable by somebody besides me (and hence, could
use feedback).

In a nutshell, it adds "idiomatic JSON" support for both RPCs and
de/serialization, in C++, Python, and Ocaml (I'd be happy to add support
for other languages, if there were interest). So (of course) it's
straightforward to modify a Thrift client/server to use JSON (over TCP or
HTTP) instead of one of the existing wire-formats. And if it's over HTTP,
you can invoke thrift services using a command-line POST tool.

You can find it at

https://github.com/chetmurthy/thrift-nicejson

And of course, if you use it, I'll be happy to help in any way. It's
released under the Apache 2.0 license.

Cheers,
--chet--
Chet Murthy
2017-11-27 23:03:35 UTC
Permalink
Post by Chet Murthy
https://github.com/chetmurthy/thrift-nicejson
Arrgh. I should have added that one of the things this library provides,
is the ability to demarshal any Thrift data, whether in-flight or at-rest,
into JSON. So a generic tool can be written (and there's an example in the
repo) that can disassemble a TBinaryProtocol file, given the "typelib"
(corresponds to the IDL file) and "type" of the message. E.g.

% THRIFT_TYPELIB_PATH=../../test/cpp/gen-typelib
./dump-binary-serialized --typelib apache.thrift.plugin.plugin --type
GeneratorInput --input-file
../../test/cpp/gen-typelib/tutorial.tutorial.binary_typelib
... JSON output elided .....


The tool ("dump-binary-serialized") is given a path of directories in which
to find type-libraries, the name of the typelib of interest, the type
inside that typelib, and the file containing serialized data. The argumens
are *clearly* too voluminous, but at this point, we're talking about
*naming*, and for instance, one could imagine a global directory wherein
the type would specified as "apache.thrift.plugin.GeneratorInput" or
something like that. And of course, if the binary-serialization included
as its first bit a string with that type, it'd get even simpler. Or
perhaps a UUID?

The reason why I mention all of this, is in hopes that somebody out there
would be interested in having this conversation and design discussion.

Thanks, and sorry for the noise,
--chet--

Loading...