2

I want to translate the javascript to python.

But when I get the bgAudio, it equals [object Object].

Anyone who can tell me how to get the value of "bgAudio".(type of json better,like {"url":"a/b/c/d/e.mp3","name":"aaa.mp3"})?

Or how to get the value of 《class '_PyV8.JSObject'》?

Thanks.

import PyV8

str_scene2 = """
var scene = {id:123321,bgAudio:{"url":"a/b/c/d/e.mp3","name":"aaa.mp3"}};
"""

s1 = str_scene2.decode('utf-8')
with PyV8.JSContext() as env1:
    env1.eval(s1)
    vars = env1.locals
    var_scene1 = vars.scene
    print var_scene1.id

    print var_scene1.bgAudio  # it shows [object Object]
    print type(var_scene1.bgAudio)  # it shows <class '_PyV8.JSObject'>
Jaccorot
  • 21
  • 2

0 Answers0