|
|
@ -238,15 +238,15 @@ impl Value { |
|
|
|
Self::Boolean(b) => Ok(JSONValue::Bool(b)), |
|
|
|
Self::Boolean(b) => Ok(JSONValue::Bool(b)), |
|
|
|
Self::Object(ref obj) => { |
|
|
|
Self::Object(ref obj) => { |
|
|
|
if obj.borrow().is_array() { |
|
|
|
if obj.borrow().is_array() { |
|
|
|
let mut arr: Vec<JSONValue> = Vec::new(); |
|
|
|
let mut keys: Vec<u32> = obj.borrow().index_property_keys().cloned().collect(); |
|
|
|
for k in obj.borrow().keys() { |
|
|
|
keys.sort(); |
|
|
|
if k != "length" { |
|
|
|
let mut arr: Vec<JSONValue> = Vec::with_capacity(keys.len()); |
|
|
|
let value = self.get_field(k.to_string()); |
|
|
|
for key in keys { |
|
|
|
|
|
|
|
let value = self.get_field(key); |
|
|
|
if value.is_undefined() || value.is_function() || value.is_symbol() { |
|
|
|
if value.is_undefined() || value.is_function() || value.is_symbol() { |
|
|
|
arr.push(JSONValue::Null); |
|
|
|
arr.push(JSONValue::Null); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
arr.push(self.get_field(k.to_string()).to_json(interpreter)?); |
|
|
|
arr.push(value.to_json(interpreter)?); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(JSONValue::Array(arr)) |
|
|
|
Ok(JSONValue::Array(arr)) |
|
|
|