1

我试图使用 jsapi 从linkedin 获取公司 ID,iam 使用下面的 url

"/company-search:(公司:(id,name))?keywords=ibm%20oracle%20infosys"

我有一些其他公司的身份证

{"companies": {
"_count": 10,
"_start": 0,
"_total": 1079,
"values": [
{
  "id": 6005,
  "name": "Sonata Software"
},
{
  "id": 5983,
  "name": "QLogic"
},
{
  "id": 39626,
  "name": "Prosoft Technology Group"
},
{
  "id": 6290,
  "name": "BCC"
},
{
  "id": 23367,
  "name": "Goldstone Technologies"
},
{
  "id": 36655,
  "name": "SoftwareONE"
},
{
  "id": 10951,
  "name": "Sirius Computer Solutions"
},
{
  "id": 10046,
  "name": "ITWorx"
},
{
  "id": 7833,
  "name": "SYSTIME"
},
{
  "id": 57561,
  "name": "ZSL Inc"
}
]
}}

如何一次获取多个公司的公司 ID

4

1 回答 1

0

为此使用 JSON.stringify 加上一个正则表达式:

JSON.stringify({"companies": {
"_count": 10,
"_start": 0,
"_total": 1079,
"values": [
{
  "id": 6005,
  "name": "Sonata Software"
},
{
  "id": 5983,
  "name": "QLogic"
},
{
  "id": 39626,
  "name": "Prosoft Technology Group"
},
{
  "id": 6290,
  "name": "BCC"
},
{
  "id": 23367,
  "name": "Goldstone Technologies"
},
{
  "id": 36655,
  "name": "SoftwareONE"
},
{
  "id": 10951,
  "name": "Sirius Computer Solutions"
},
{
  "id": 10046,
  "name": "ITWorx"
},
{
  "id": 7833,
  "name": "SYSTIME"
},
{
  "id": 57561,
  "name": "ZSL Inc"
}
]
}}).match(/id..\d+/g) 

/* Returns:
["id":6005", "id":5983", "id":39626", "id":6290", "id":23367", "id":36655", "id":10951", "id":10046", "id":7833", "id":57561"] 
*/
于 2013-12-05T01:20:10.767 回答