0
我要採取一切後,\「標籤 \」的鍵值對下‘instanceData’,並‘性能’下他們的鍵值對。如何將json字符串轉換爲鍵值對?
我有這個...
{
"id": "/subscriptions/1234abcd-ab12-12ab-12ab-abcdfghi1234/Daily_BRSDT_20161214_0000",
"name": "Daily_BRSDT_20161214_0000",
"type": "Microsoft.Commerce/UsageAggregate",
"properties": {
"subscriptionId": "1234abcd-ab12-12ab-12ab-abcdfghi1234",
"usageStartTime": "2017-03-08T00:00:00+00:00",
"usageEndTime": "2017-03-09T00:00:00+00:00",
"meterName": "Standard IO - File Read Operation Units (in 10,000s)",
"meterCategory": "Data Management",
"unit": "10,000s",
"instanceData": "{\"Microsoft.Resources\":{\"resourceUri\":\"/subscriptions/1234abcd-ab12-12ab-12ab-abcdfghi1234/resourceGroups/default-resource-group67/providers/Microsoft.Storage/storageAccounts/defaultstorage67\",\"location\":\"ussouthcentral\",\"tags\":{\"ProjectName\":\"default Portal\",\"billTo\":\"Technology\",\"component\":\"Persistant Storage\",\"department\":\"Technology\",\"displayName\":\"default Portal Storage Account\",\"enviornment\":\"default\",\"function\":\"Reporting\",\"matterNumber\":\"999999\",\"primaryowner\":\"[email protected]\",\"productLine\":\"Information Components\",\"secondaryowner\":\"[email protected]\",\"version\":\"1.0.0.0\"}}}",
"meterId": "12345ab-259d-4206-a6ae-12345678abcd",
"infoFields": {},
"quantity": 0.0004
}
}
我想這...
{
"id": "/subscriptions/1234abcd-ab12-12ab-12ab-abcdfghi1234/Daily_BRSDT_20161214_0000",
"name": "Daily_BRSDT_20161214_0000",
"type": "Microsoft.Commerce/UsageAggregate",
"properties": {
"subscriptionId": "1234abcd-ab12-12ab-12ab-abcdfghi1234",
"usageStartTime": "2017-03-08T00:00:00+00:00",
"usageEndTime": "2017-03-09T00:00:00+00:00",
"meterName": "Standard IO - File Read Operation Units (in 10,000s)",
"meterCategory": "Data Management",
"unit": "10,000s",
"instanceData": "{\"Microsoft.Resources\":{\"resourceUri\":\"/subscriptions/1234abcd-ab12-12ab-12ab-abcdfghi1234/resourceGroups/default-resource-group67/providers/Microsoft.Storage/storageAccounts/defaultstorage67\",\"location\":\"ussouthcentral\"}}",
"ProjectName":"default Portal",
"billTo":"Technology",
"component":"Persistant Storage",
"department":"Technology",
"displayName":"default Portal Storage Account",
"enviornment":"default",
"function":"Reporting",
"matterNumber":"999999",
"primaryowner":"[email protected]",
"productLine":"Information Components",
"secondaryowner":"[email protected]",
"version":"1.0.0.0",
"meterId": "12345ab-259d-4206-a6ae-12345678abcd",
"infoFields": {},
"quantity": 0.0004
}
}
是否有轉換這種簡單的方法是什麼?我試圖用RegEx做到這一點,但沒有運氣。
與正則表達式?這聽起來像一場噩夢。不要這樣做。什麼語言? –
bash,php,java?必須有更多的正則表達式 –
我正在使用C#編寫庫# – Gooch