cbor
cbor copied to clipboard
testing with json/cbor streams
take a look at https://github.com/ugorji/go/issues/86#issuecomment-122159403 -- i updated it with support for this module. but the encoder doesn't seem to output anything:
> random-json -o -c 1 | ./json2cbor --codec dw j2c
> random-json -o -c 1 | ./json2cbor --codec dw j2c | wc
1 0 1
> random-json -o -c 1 | ./json2cbor --codec ugorji j2c | wc
1 4 140
> random-json -o -c 1 | ./json2cbor --codec ugorji j2c
�j5
HP]WXg�a�� g��A/sB:����^z�xq�="�x�)���M��Mw46E�(�V����8��*������=�O$8�e����d�/�bޙ�s$��3�...
I just test this out myself, I got this output
random-json -o -c 1 | tee a.json | json2cbor j2c | json2cbor --codec dw c2j
{"@�":false,"�P�f�?":"HXH�h�\u000bM9����Qf�7\u0016���\u0012Ք\u000eY]��\u0013\u0007�p����o\u0004","̄":true,"\u000b'���P��":4079677795,"\u000e��+cc":"�\u0018I���[+\\2��,�M","'v��c�gR":2.1401536489761717E+00,"�~�":true,"�C�ߦ��G�":-6.499906972611231E-01,"¬���x��r̢":3691413261,"zЩ��wV�":8.571265201623061E-01}expected *interface {}, got **uint8 (major 0, info 10 [0xa])
You also get a warning from the encoder expected *interface {}, got **uint8 (major 0, info 10 [0xa])
I just took a look at the json2cbor code and I found that in the dw wrapper is using ugorji codec for encoding/decoding, no idea if that is WAI or not
https://github.com/jbenet/go-json2cbor/blob/master/codec.go#L37 https://github.com/jbenet/go-json2cbor/blob/master/codec.go#L44
By the way, I created this encoder/decoder library as an exercise to sharp mi Go skills, even it has more features than ugorji, ugorji is faster.
I just test this out myself, I got this output
are you on 267653f36473451f5c9486d3d2b757aeb98e9bb1 ?
I just took a look at the json2cbor code and I found that in the dw wrapper is using ugorji codec for encoding/decoding, no idea if that is WAI or not
It's using the ugorji JSON enc/dec. it's possible that's a problem, but doubt it.
By the way, I created this encoder/decoder library as an exercise to sharp mi Go skills, even it has more features than ugorji, ugorji is faster.
ugorji one doesn't seem to work perfectly either :(