如何从JSON数组中删除双引号

时间:2016-11-29 18:31:54

标签: javascript angularjs

var json = [
  "{"AccountType":"CurrentLiability","AccountCode":"880","Name":"Owner A Drawings"}", 
  "{"AccountType":"CurrentLiability","AccountCode":"881","Name":"Owner A Funds Introduced"}", 
  "{"AccountType":"TermLiability","AccountCode":"900","Name":"Loan"}", 
  "{"AccountType":"Equity","AccountCode":"960","Name":"Retained Earnings"}", 
  "{"AccountType":"Equity","AccountCode":"970","Name":"Owner A Share Capital"}"
]

我想要这种格式: -

[Object, Object, Object, Object, Object, Object, Object, Object]

Array[62]
0
:
Object
$$hashKey
:
"object:3216"
AccountCode
:
"090"
AccountType
:
"Bank"
Name
:
"Business Bank Account"
__proto__
:
Object
1
:
Object
2
:
Object

1 个答案:

答案 0 :(得分:0)

试试这个:

print(type(of: test)) // Test
print(test2) // <__lldb_expr_22.Test: 0x7ffe8cb063e0>

let isEqual = type(of:test2) == type(of: test) // true