i = unicode(i) new_element = walk(val, i, reviver) if new_element.is_undefined(): val.delete(i) else: new_element.put(i, new_element) elif val.is_object(): for key in val: new_element = walk(val, key, reviver) if new_element.is_undefined(): val.delete(key) else: val.put(key, new_element) return reviver.call(holder, (name, val)) JSON = Js({}) JSON.define_own_property('parse', {'value': Js(parse), 'enumerable': False, 'writable': True, 'configurable': True}) JSON.define_own_property('stringify', {'value': Js(stringify), 'enumerable': False, 'writable': True, 'configurable': True})
new_element = walk(val, i, reviver) if new_element.is_undefined(): val.delete(i) else: new_element.put(i, new_element) elif val.is_object(): for key in val: new_element = walk(val, key, reviver) if new_element.is_undefined(): val.delete(key) else: val.put(key, new_element) return reviver.call(holder, (name, val)) JSON = Js({}) JSON.define_own_property( 'parse', { 'value': Js(parse), 'enumerable': False, 'writable': True, 'configurable': True }) JSON.define_own_property( 'stringify', { 'value': Js(stringify), 'enumerable': False, 'writable': True, 'configurable': True