You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何提取含子数组的JSON样本数据并分配至对应字段?

Extracted JSON Data Breakdown

Here's a complete, organized breakdown of all fields pulled from your sample JSON, mapped to their corresponding categories:

Core Device Identifier

  • Full IMEI: 35XXXXXXXXXXXXX
  • IMEI Components:
    • TAC (Type Allocation Code): 35XXXX
    • FAC (Final Assembly Code): XX
    • CD (Check Digit): X
    • SNR (Serial Number): XXXXXX

Basic Device Metadata

  • Brand: NOKIA

Detailed Hardware Specifications

  • Weight: 130.0 grams
  • Battery:
    • Type: Li-Ion
    • Capacity: 850 mAh
  • QWERTY Keyboard Enabled: False
  • Release Date: 2002 September (derived from the year array: ["2002", "09"])
  • UMTS Talk Time: 0.0 hours
  • Standby Time: 200.0 hours
  • Touch Screen Enabled: False
  • Physical Dimensions:
    • Width: 57.0 mm
    • Thickness: 26.0 mm
    • Height: 130.0 mm
  • Wi-Fi Hotspot Supported: False
  • CPU Clock Speed: 104 MHz (truncated value from sample data)

If you need to automate this extraction programmatically, here's a quick Python example using the built-in json module:

import json

# Sample JSON input (formatted for readability)
sample_data = '''{
  "imei": "35XXXXXXXXXXXXX",
  "imei_parts": { "fac": "XX", "cd": "X", "snr": "XXXXXX", "tac": "35XXXX" },
  "brand": "NOKIA",
  "info": {
    "weight": 130.0,
    "battery": [ "Li-Ion", 850 ],
    "qwerty": false,
    "year": [ "2002", "09" ],
    "talk_time_umts": 0.0,
    "stand_by": 200.0,
    "touch_scr": false,
    "size": { "width": 57.0, "thickness": 26.0, "height": 130.0 },
    "wifi_hotspot": false,
    "cpu_clock": 104
  }
}'''

# Parse the JSON string into a dictionary
parsed_data = json.loads(sample_data)

# Extract specific fields with direct key indexing
brand_name = parsed_data["brand"]
battery_type = parsed_data["info"]["battery"][0]
release_date = f"{parsed_data['info']['year'][0]}-{parsed_data['info']['year'][1]}"

# Output example
print(f"Device Brand: {brand_name}")
print(f"Release Date: {release_date}")
print(f"Battery Type: {battery_type}")

This code lets you access nested objects and array elements directly, making it easy to pull any field you need from the JSON structure.

内容的提问来源于stack exchange,提问作者BRAHMA

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 04:16:18