"github.com/widuu/gojson"
需要解析的json是如下格式 : 主要是想取得properties 里面字段的值,求思路
//c10 := gojson.Json(json1).Getindex(3).Getindex(1).Getindex(1).Get("src").Tostring()
这个APi参数看了半天没懂!!!!!
[
{
"content": null,
"deleted": false,
"metadata": null,
"name": "Spapp20180116101712",
"properties": {
"appendBlobCommittedBlockCount": null,
"blobTier": null,
"blobTierChangeTime": null,
"blobTierInferred": false,
"blobType": "PageBlob",
"contentLength": 136367309312,
"contentRange": null,
"contentSettings": {
"cacheControl": null,
"contentDisposition": null,
"contentEncoding": null,
"contentLanguage": null,
"contentMd5": "d51vZtE02c9nshI8TMCzMg==",
"contentType": "application/octet-stream"
},
"copy": {
"completionTime": null,
"id": null,
"progress": null,
"source": null,
"status": null,
"statusDescription": null
},
"deletedTime": null,
"etag": "0x8D562DCC9199713",
"lastModified": "2018-01-24T03:44:34+00:00",
"lease": {
"duration": "infinite",
"state": "leased",
"status": "locked"
},
"pageBlobSequenceNumber": null,
"remainingRetentionDays": null,
"sequenceNumber": 5,
"serverEncrypted": false
},
"snapshot": null
},
{
"content": null,
"deleted": false,
"metadata": null,
"name": "oracle-c65o10g-2017-12-24-10-17-27-541-0",
"properties": {
"appendBlobCommittedBlockCount": null,
"blobTier": null,
"blobTierChangeTime": null,
"blobTierInferred": false,
"blobType": "PageBlob",
"contentLength": 32212255232,
"contentRange": null,
"contentSettings": {
"cacheControl": null,
"contentDisposition": null,
"contentEncoding": null,
"contentLanguage": null,
"contentMd5": "nwidyVR2BIMrOy8odGM2zA==",
"contentType": "application/octet-stream"
},
"copy": {
"completionTime": null,
"id": null,
"progress": null,
"source": null,
"status": null,
"statusDescription": null
},
"deletedTime": null,
"etag": "0x8D55C871C51C207",
"lastModified": "2018-01-16T02:16:10+00:00",
"lease": {
"duration": null,
"state": "available",
"status": "unlocked"
},
"pageBlobSequenceNumber": null,
"remainingRetentionDays": null,
"sequenceNumber": 15,
"serverEncrypted": true
},
"snapshot": null
},
{
"content": null,
"deleted": false,
"metadata": null,
"name": "oracleg20180103175200",
"properties": {
"appendBlobCommittedBlockCount": null,
"blobTier": null,
"blobTierChangeTime": null,
"blobTierInferred": false,
"blobType": "PageBlob",
"contentLength": 136367309312,
"contentRange": null,
"contentSettings": {
"cacheControl": null,
"contentDisposition": null,
"contentEncoding": null,
"contentLanguage": null,
"contentMd5": "uXRqWg3vEhrQVqDfFg6nIg==",
"contentType": "application/octet-stream"
},
"copy": {
"completionTime": null,
"id": null,
"progress": null,
"source": null,
"status": null,
"statusDescription": null
},
"deletedTime": null,
"etag": "0x8D562DCCA4CAF7F",
"lastModified": "2018-01-24T03:44:36+00:00",
"lease": {
"duration": "infinite",
"state": "leased",
"status": "locked"
},
"pageBlobSequenceNumber": null,
"remainingRetentionDays": null,
"sequenceNumber": 14,
"serverEncrypted": false
},
"snapshot": null
},
{
"content": null,
"deleted": false,
"metadata": null,
"name": "windowshare20171226153514",
"properties": {
"appendBlobCommittedBlockCount": null,
"blobTier": null,
"blobTierChangeTime": null,
"blobTierInferred": false,
"blobType": "PageBlob",
"contentLength": 136367309312,
"contentRange": null,
"contentSettings": {
"cacheControl": null,
"contentDisposition": null,
"contentEncoding": null,
"contentLanguage": null,
"contentMd5": "uXRqWg3vEhrQVqDfFg6nIg==",
"contentType": "application/octet-stream"
},
"copy": {
"completionTime": null,
"id": null,
"progress": null,
"source": null,
"status": null,
"statusDescription": null
},
"deletedTime": null,
"etag": "0x8D54C33B1430833",
"lastModified": "2017-12-26T07:38:44+00:00",
"lease": {
"duration": null,
"state": "available",
"status": "unlocked"
},
"pageBlobSequenceNumber": null,
"remainingRetentionDays": null,
"sequenceNumber": 1,
"serverEncrypted": false
},
"snapshot": null
}
]
写个结构对应一下就好了啊
```go
type Reply struct{
Prop struct {
...
} `json:"properties"
}
```
#1
更多评论
gojson.Json(json1).Getindex(3).Getindex(1).Getindex(1).Get("src").Tostring()
是不是对应javascript里面的
json1[3][1][1]['src']
#2