GitHub user timse opened a pull request: https://github.com/apache/thrift/pull/379
Trying to fix json protocol for nodejs this fixes: https://issues.apache.org/jira/browse/THRIFT-2994 (not sure if that is the correct way to link a jira ticket :smile: ) It initializes the arrays used to build up the json on construct and writes to transport whenever a `writeEnd` method is encountered and the stack lenth is 1, assuming its finished now. You can merge this pull request into a Git repository by running: $ git pull https://github.com/timse/thrift trying-to-fix-json_protocol-for-nodejs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/379.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #379 ---- commit 6855c207152f24d341f7783d1098bde3f275c0b8 Author: Tim Sebastian <tim.sebast...@gmail.com> Date: 2015-02-13T17:18:23Z initialize "tstack" and "tpos" in constructor as all write methods require them to exist it does not seem to make too much sense to only make them available in the "writeMessageBegin" method commit 2cd5e95b367c73981bff470cc7db1e04699871a6 Author: Tim Sebastian <tim.sebast...@gmail.com> Date: 2015-02-13T17:23:56Z introduce method "writeToTransport" to write to transport - removed direct writing to transport from "writeMessageEnd" - "writeToTransport" only acts if "tstack.length === 1", it assumed that we are finished then and the last item is the final json string - call "writeToTranport" in the "flush" method commit 6ce537a0ba93ff3af205360d804e41539b112e3b Author: Tim Sebastian <tim.sebast...@gmail.com> Date: 2015-02-13T17:26:13Z call "writeToTransport" if we are the last item in the queue ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---