本文整理匯總了Golang中github.com/pomack/jsonhelper/go/jsonhelper.JSONObject.GetAsArray方法的典型用法代碼示例。如果您正苦於以下問題:Golang JSONObject.GetAsArray方法的具體用法?Golang JSONObject.GetAsArray怎麽用?Golang JSONObject.GetAsArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pomack/jsonhelper/go/jsonhelper.JSONObject
的用法示例。
在下文中一共展示了JSONObject.GetAsArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: FromJSON
func (p *yahooUserInfoResult) FromJSON(props jsonhelper.JSONObject) {
p.guid = props.GetAsString("guid")
p.uri = props.GetAsString("uri")
p.birthYear = props.GetAsInt("birthYear")
p.birthdate = props.GetAsString("birthdate")
p.created = props.GetAsTime("created", YAHOO_DATETIME_FORMAT)
p.displayAge = props.GetAsInt("displayAge")
emails := props.GetAsArray("emails")
p.emails = make([]YahooUserInfoEmail, len(emails))
for i, email := range emails {
v := new(yahooUserInfoEmail)
v.FromJSON(jsonhelper.JSONValueToObject(email))
p.emails[i] = v
}
p.familyName = props.GetAsString("familyName")
p.givenName = props.GetAsString("givenName")
p.gender = props.GetAsString("gender")
ims := props.GetAsArray("ims")
p.ims = make([]YahooUserInfoIm, len(ims))
for i, im := range ims {
v := new(yahooUserInfoIm)
v.FromJSON(jsonhelper.JSONValueToObject(im))
p.ims[i] = v
}
p.lang = props.GetAsString("lang")
p.location = props.GetAsString("location")
p.memberSince = props.GetAsTime("memberSince", YAHOO_DATETIME_FORMAT)
p.nickname = props.GetAsString("nickname")
p.profileUrl = props.GetAsString("profileUrl")
p.searchable = props.GetAsBool("searchable")
p.timeZone = props.GetAsString("timeZone")
p.updated = props.GetAsTime("updated", YAHOO_DATETIME_FORMAT)
p.isConnected = props.GetAsBool("isConnected")
}
示例2: FromJSON
func (p *googleUserInfoResult) FromJSON(props jsonhelper.JSONObject) {
p.id = props.GetAsObject("id").GetAsString("$t")
authorArr := props.GetAsArray("author")
if len(authorArr) > 0 {
author := jsonhelper.JSONValueToObject(authorArr[0])
p.name = author.GetAsObject("name").GetAsString("$t")
p.email = author.GetAsObject("email").GetAsString("$t")
}
for _, l := range props.GetAsArray("link") {
m := jsonhelper.JSONValueToObject(l)
if m.GetAsString("rel") == _GOOGLE_USERINFO_FEED_REL {
p.uri = m.GetAsString("href")
}
}
p.updated = props.GetAsObject("updated").GetAsTime("$t", GOOGLE_DATETIME_FORMAT)
}