如何使用jq命令解析含哈希符号#的JSON键?
Extracting the Target Delivery Summary Object from Your JSON
Hey there! Let's pull out that specific delivery summary object you need from your JSON data. Here's how to do it easily:
First, let's look at your original JSON structure for context:
{ "module": { "data": { "deliverySummary_200648721592191#address": { "fields": { "address": "MyAddress", "consignee": "MyName", "phone": "MyPhone", "postCode": "", "title": "Alamat Pengiriman \r\n" }, "id": "200648721592191#address", "tag": "deliverySummary", "type": "biz" } } } }
The object you're after is nested under module.data with the key deliverySummary_200648721592191#address. Here's the extracted content you requested:
{ "fields": { "address": "MyAddress", "consignee": "MyName", "phone": "MyPhone", "postCode": "", "title": "Alamat Pengiriman \r\n" }, "id": "200648721592191#address", "tag": "deliverySummary", "type": "biz" }
If you're working with a programming language like JavaScript, you can access this object programmatically using bracket notation (since the key has special characters):
const originalJson = { /* your full JSON data here */ }; const extractedDeliverySummary = originalJson.module.data["deliverySummary_200648721592191#address"];
That will directly give you the exact object you're looking for.
内容的提问来源于stack exchange,提问作者Joe
相关产品推荐
相关产品推荐

