Fix serialization of nested arrays in JSON.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
bb67196aa5
commit
823c8a54f4
|
@ -28,16 +28,16 @@ def tv_value_json(value, bitcoin_flavoured):
|
||||||
value = value.thing
|
value = value.thing
|
||||||
|
|
||||||
def bitcoinify(value):
|
def bitcoinify(value):
|
||||||
|
if type(value) == list:
|
||||||
|
return [bitcoinify(v) for v in value]
|
||||||
|
|
||||||
if type(value) == bytes:
|
if type(value) == bytes:
|
||||||
if bitcoin_flavoured and len(value) == 32:
|
if bitcoin_flavoured and len(value) == 32:
|
||||||
value = value[::-1]
|
value = value[::-1]
|
||||||
value = hexlify(value).decode()
|
value = hexlify(value).decode()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if type(value) == list:
|
return bitcoinify(value)
|
||||||
return [bitcoinify(v) for v in value]
|
|
||||||
else:
|
|
||||||
return bitcoinify(value)
|
|
||||||
|
|
||||||
def tv_json(filename, parts, vectors, bitcoin_flavoured):
|
def tv_json(filename, parts, vectors, bitcoin_flavoured):
|
||||||
if type(vectors) == type({}):
|
if type(vectors) == type({}):
|
||||||
|
|
Loading…
Reference in New Issue