We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example thrift struct
struct Prediction { 10: i64 userId, 20: list<double> rawPrediction, 30: list<double> probability, 40: double prediction }
Set up code
val pred = Prediction(123L, List(0.232,0.1234), List(0.123, 0.6789), 1.0) val jsonCodec = JsonScalaCodec(Prediction)
Scrooge to string
scala> jsonCodec(pred) res0: String = eyIxMCI6eyJpNjQiOjEyM30sIjIwIjp7ImxzdCI6WyJkYmwiLDIsMC4yMzIsMC4xMjM0XX0sIjMwIjp7ImxzdCI6WyJkYmwiLDIsMC4xMjMsMC42Nzg5XX0sIjQwIjp7ImRibCI6MS4wfX0=
The result String base64 decoded yields
{"10":{"i64":123},"20":{"lst":["dbl",2,0.232,0.1234]},"30":{"lst":["dbl",2,0.123,0.6789]},"40":{"dbl":1.0}}
This output is far from being human readable. I was expecting something along the lines of
{"userId":123,"rawPrediction":[0.232,0.1234],"probability":[0.123,0.6789],"prediction":1}
The text was updated successfully, but these errors were encountered:
This is by design, I believe. It uses the same protocol that thrift/scrooge uses to serialize thrift structs as json:
https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java
Sorry, something went wrong.
No branches or pull requests
Example thrift struct
Set up code
Scrooge to string
The result String base64 decoded yields
This output is far from being human readable. I was expecting something along the lines of
The text was updated successfully, but these errors were encountered: