我有一个对象数组作为JSON响应的一部分进入,如下所示。我需要提取“值”字符串项之一。但是,问题在于某些“值”项是字符串,有些是字符串数组,有些是对象本身。有关如何进行此操作的任何建议?
这是我正在谈论的JSON部分(我需要提取员工编号的值):
"meta_data": [
{
"id": 20,
"key": "wc_last_active",
"value": "1591574400"
},
{
"id": 21,
"key": "jetpack_tracks_anon_id",
"value": "jetpack:XPs4qwPuwtU9/37vf635CIal"
},
{
"id": 22,
"key": "wpsl_disable_key_warning",
"value": "true"
},
{
"id": 26,
"key": "nav_menu_recently_edited",
"value": "52"
},
{
"id": 27,
"key": "managenav-menuscolumnshidden",
"value": [
"link-target",
"css-classes",
"xfn",
"description",
"title-attribute"
]
},
{
"id": 40,
"key": "dismissed_no_shipping_methods_notice",
"value": "1"
},
{
"id": 41,
"key": "dismissed_no_secure_connection_notice",
"value": "1"
},
{
"id": 108,
"key": "iconic-register-text",
"value": "54321"
},
{
"id": 111,
"key": "employee_number",
"value": "5432145623"
},
{
"id": 199,
"key": "tgmpa_dismissed_notice_tgmpa",
"value": "1"
},
{
"id": 207,
"key": "community-events-location",
"value": {
"ip": "xxxxxxxxxxxx"
}
},
{
"id": 295,
"key": "mobiconnector-avatar",
"value": ""
},
{
"id": 367,
"key": "shipping_method",
"value": ""
},
{
"id": 368,
"key": "shipping_email",
"value": "xxxxxxxxxxx"
},
{
"id": 369,
"key": "shipping_phone",
"value": "xxxxxxxxxx"
},
{
"id": 579,
"key": "dismissed_update_notice",
"value": "1"
},
{
"id": 800,
"key": "supsystic-tables-tutorial_was_showed",
"value": "1"
},
{
"id": 801,
"key": "dismissed_template_files_notice",
"value": "1"
},
{
"id": 804,
"key": "managetablepress_listcolumnshidden",
"value": [
"table_last_modified_by"
]
},
{
"id": 1849,
"key": "edit_shop_order_per_page",
"value": "100"
}
]