本文整理汇总了C#中System.Json.JsonValue类的典型用法代码示例。如果您正苦于以下问题:C# JsonValue类的具体用法?C# JsonValue怎么用?C# JsonValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonValue类属于System.Json命名空间,在下文中一共展示了JsonValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ViewResultRow
/// <constructor />
public ViewResultRow(JsonValue key, JsonValue value, string documentId, Document document)
{
Key = key;
Value = value;
DocumentId = documentId;
Document = document;
}
开发者ID:artikh,项目名称:CouchDude,代码行数:8,代码来源:ViewResultRow.cs
示例2: WorkshopSetAdapter
/*private void ParseAndDisplay (JsonValue json, ListView workshopList)
{
string jsonString = json.ToString();
WorkshopSetResult root = JsonConvert.DeserializeObject<WorkshopSetResult> (jsonString);
workshopSets = root.Results;
workshopList = FindViewById<ListView> (Resource.Id.workshopList);
WorkshopSetAdapter adapter = new WorkshopSetAdapter (this, workshopSets);
workshopList.Adapter = adapter;
//workshopList.ItemClick += workshopList_ItemClick;
workshopList.ItemClick += async (object sender, AdapterView.ItemClickEventArgs e) =>
{
int clickedID = workshopSets [e.Position].id;
string url = String.Format ("http://uts-helps-07.cloudapp.net/api/workshop/search?workshopSetID={0}", clickedID);
Console.WriteLine("Clicked ID is {0}", clickedID);
Console.WriteLine(url);
JsonValue j = await FetchWorkshopAsync (url);
string jObject = j.ToString();
Intent intent = new Intent (this, typeof(WorkshopActivity));
//intent.PutExtra ("WorkshopSetID", clickedID);
intent.PutExtra("JsonValue", jObject);
this.StartActivity (intent);
};
}
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:27,代码来源:WorkshopSetActivity.cs
示例3: MakeRestaurantInspectionDto
public static RestaurantInspectionDto MakeRestaurantInspectionDto(JsonValue returnString)
{
var returnStringResults = returnString["result"];
var inspectionList = new List<RestaurantInspectionDto>();
var inspectionData = new RestaurantInspectionDto();
if (returnStringResults["total"] != 0)
{
var returnStringRecords = returnStringResults["records"];
foreach (JsonValue establishment in returnStringRecords)
{
var locationFound = new RestaurantInspectionDto()
{
EstablishmentId = establishment["EstablishmentId"],
EstablishmentName = establishment["EstablishmentName"],
Grade = establishment["Grade"],
Score = establishment["Score"],
InspectionDate = establishment["InspectionDate"]
};
inspectionList.Add(locationFound);
}
inspectionData = inspectionList.OrderByDescending(i => i.InspectionDate).ToList().FirstOrDefault();
}
return inspectionData;
}
开发者ID:CodeMonkeyLaura,项目名称:DangerouslyDelicious,代码行数:29,代码来源:ParseJson.cs
示例4: MakeYelpListingDto
public static List<YelpListingDto> MakeYelpListingDto(JsonValue restaurantList)
{
var yelpListingDtoList = new List<YelpListingDto>();
var businesses = restaurantList["businesses"];
foreach (JsonValue business in businesses)
{
var location = business["location"];
var address = location["address"];
var coordinates = location["coordinate"];
var listing = new YelpListingDto()
{
Id = business["id"],
Name = business["name"],
Address = address[0],
City = location["city"],
Latitude = coordinates["latitude"],
Longitude = coordinates["longitude"],
LocationClosed = business["is_closed"],
MobileUrl = business["mobile_url"],
Rating = business["rating"],
NumberReviews = business["review_count"],
RatingImage = business["rating_img_url_large"]
};
yelpListingDtoList.Add(listing);
}
return yelpListingDtoList;
}
开发者ID:CodeMonkeyLaura,项目名称:DangerouslyDelicious,代码行数:32,代码来源:ParseJson.cs
示例5: Initalize
public static EditTournamentStateDialog Initalize(JsonValue _json, Activity _context)
{
var dialogFragment = new EditTournamentStateDialog();
dialogFragment.json = _json;
dialogFragment.context = _context;
return dialogFragment;
}
开发者ID:coldlink,项目名称:challonger,代码行数:7,代码来源:EditTournamentStateDialog.cs
示例6: RelationshipUser
public RelationshipUser(JsonValue json)
{
Id = json["id"];
ScreenName = json["screen_name"];
IsFollowing = json["following"];
IsFollowedBy = json["followed_by"];
}
开发者ID:bling,项目名称:Ping.Pong,代码行数:7,代码来源:Relationship.cs
示例7: displayString
private string displayString(JsonValue input)
{
string s = input.ToString ();
int l = s.Length-2;
string output = s.Substring(1, l);
return output;
}
开发者ID:bny-mobile,项目名称:RemoteData,代码行数:7,代码来源:Tweet.cs
示例8: Parser
internal Parser(JsonValue json)
{
_sourceparser = json;
MissingTokens = json.ContainsKey("missing_tokens")
? new HashSet<string>(json["missing_tokens"].Select(x => (string) x))
: new HashSet<string>();
}
开发者ID:CVertex,项目名称:bigml-csharp,代码行数:7,代码来源:Parser.cs
示例9: Torrent
public Torrent(JsonValue json)
{
if (json.Count == 1)
{
ID = json[0];
return;
}
int index = 0;
ID = json[index++];
Status = (TorrentStatus)(int)json[index++];
Name = json[index++];
Size = json[index++];
PercentProgress = json[index++];
Downloaded = json[index++];
Uploaded = json[index++];
Ratio = json[index++];
UploadSpeed = json[index++];
DownloadSpeed = json[index++];
Eta = json[index++];
Label = json[index++];
PeersConnected = json[index++];
PeersInSwarm = json[index++];
SeedsConnected = json[index++];
SeedsInSwarm = json[index++];
Availability = json[index++];
QueueOrder = json[index++];
Remaining = json[index++];
}
开发者ID:jonathanpeppers,项目名称:uController,代码行数:29,代码来源:Torrent.cs
示例10: UserMention
public UserMention(JsonValue json)
{
Id = json["id"];
Name = json["name"];
ScreenName = json["screen_name"];
Indices = ((JsonArray)json["indices"]).Select(x => (int)x).ToArray();
}
开发者ID:bling,项目名称:Ping.Pong,代码行数:7,代码来源:Tweet.cs
示例11: ToInt
public static int ToInt (JsonValue jsonValue, string key, int defaultValue = 0)
{
int returnValue = JsonUtil.ContainsKey (jsonValue, key)
? jsonValue [key] as JsonPrimitive
: defaultValue;
return returnValue;
}
开发者ID:avantidesai,项目名称:EmpireCLS,代码行数:7,代码来源:JsonUtil.cs
示例12: ClassDefiniation
public ClassDefiniation(string propertyName, JsonValue jValue, StringBuilder sb, string classHeadser)
{
PropertyName = propertyName;
JValue = jValue;
StringBuilder = sb;
ClassHeader = classHeadser;
}
开发者ID:JDCB,项目名称:JDCB,代码行数:7,代码来源:SimpleJsonToDataContractHelper.cs
示例13: RateLimitStatus
public RateLimitStatus(JsonValue json)
{
var resources = json["resources"];
HelpConfiguration = new RateLimit(resources["help"]["/help/configuration"]);
HelpPrivacy = new RateLimit(resources["help"]["/help/privacy"]);
StatusesOembed = new RateLimit(resources["statuses"]["/statuses/oembed"]);
}
开发者ID:bling,项目名称:Ping.Pong,代码行数:7,代码来源:RateLimit.cs
示例14: ToString
public static string ToString (JsonValue jsonValue, string key, string defaultValue = "")
{
string returnValue = JsonUtil.ContainsKey (jsonValue, key)
? jsonValue [key] as JsonPrimitive
: defaultValue;
return returnValue;
}
开发者ID:avantidesai,项目名称:EmpireCLS,代码行数:7,代码来源:JsonUtil.cs
示例15: GetJsonValue
private object GetJsonValue(JsonValue member) {
object result = null;
if (member.JsonType == JsonType.Array) {
var array = member as JsonArray;
if (array.Any()) {
if (array.First().JsonType == JsonType.Object || array.First().JsonType == JsonType.Array)
result = array.Select(x => new DynamicJsonObject(x as JsonObject)).ToArray();
else
result = array.Select(x => GetJsonValue(x)).ToArray();
}
else
result = member;
}
else if (member.JsonType == JsonType.Object) {
return new DynamicJsonObject(member as JsonObject);
}
else if (member.JsonType == JsonType.Boolean)
return (bool)member;
else if (member.JsonType == JsonType.Number) {
string s = member.ToString();
int i;
if (int.TryParse(s, out i))
return i;
else return double.Parse(s);
}
else
return (string)member;
return result;
}
开发者ID:curtisrutland,项目名称:RottenTomatoes.NET,代码行数:30,代码来源:DynamicJsonObject.cs
示例16: ParseFriendInfo
public static void ParseFriendInfo(Friend buddy, JsonValue item)
{
//buddy.Status = QQHelper.ParseOnlineStatus(item["stat"]).ToString();
buddy.NickName = item["nick"].ToString().Trim('\"');
buddy.Country = item["country"].ToString();
buddy.PersonalElucidation = item["province"].ToString();
buddy.City = item["city"].ToString();
buddy.Sex = item["gender"].ToString();
buddy.Face = item["face"].ToString();
var birthday = item["birthday"];
int year = (int)birthday["year"];
int month = (int)birthday["month"];
int day = (int)birthday["day"];
buddy.Birthday = new DateTime(year, month, day).ToString();
buddy.Allow = item["allow"].ToString();
buddy.Blood = item["blood"].ToString();
buddy.ShengXiao = item["shengxiao"].ToString();
buddy.Constel = item["constel"].ToString();
buddy.TelePhone = item["phone"].ToString();
buddy.MPhone = item["mobile"].ToString();
buddy.Email = item["email"].ToString();
buddy.Occupation = item["occupation"].ToString();
buddy.College = item["college"].ToString();
buddy.HomeUrl = item["homepage"].ToString();
buddy.PersonalElucidation = item["personal"].ToString();
}
开发者ID:FormatD,项目名称:qqrobot,代码行数:26,代码来源:EntityBuilder.cs
示例17: GetString
public static string GetString(JsonValue obj, string key)
{
if (obj.ContainsKey(key))
if (obj[key].JsonType == JsonType.String)
return (string)obj[key];
return null;
}
开发者ID:josiahpeters,项目名称:CCBoise,代码行数:7,代码来源:DrupalApiParser.cs
示例18: MakeLocationMatchDto
private static List<LocationMatchDto> MakeLocationMatchDto(JsonValue returnString)
{
var returnStringResults = returnString["result"];
var restaurantMatches = new List<LocationMatchDto>();
if (returnStringResults["total"] != 0)
{
var returnStringRecords = returnStringResults["records"];
foreach (JsonValue establishment in returnStringRecords)
{
var foundLocation = new LocationMatchDto()
{
Name = establishment["PremiseName"],
StreetNumber = establishment["PermiseStreetNo"],
StreetName = establishment["PremiseStreet"],
EstablishmentId = establishment["EstablishmentID"],
Latitude = establishment["latitude"],
Longitude = establishment["longitude"]
};
restaurantMatches.Add(foundLocation);
}
}
return restaurantMatches;
}
开发者ID:CodeMonkeyLaura,项目名称:DangerouslyDelicious,代码行数:27,代码来源:RestaurantInspectionData.cs
示例19: ConvertIntoCLRType
public string ConvertIntoCLRType(string keyName, string typeName, string toStringFormat, JsonValue input)
{
switch (typeName.ToLowerInvariant())
{
case "datetime":
DateTime dt = (DateTime)input[keyName];
return dt.ToString(toStringFormat, CultureInfo.InvariantCulture);
case "int":
return ((int)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "short":
return ((short)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "long":
return ((long)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "sbyte":
return ((sbyte)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "byte":
return ((byte)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "ushort":
return ((ushort)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "uint":
return ((uint)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "ulong":
return ((ulong)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "decimal":
return ((decimal)input[keyName]).ToString(CultureInfo.InvariantCulture);
case "double":
return ((double)input[keyName]).ToString("R", CultureInfo.InvariantCulture);
case "float":
return ((float)input[keyName]).ToString("R", CultureInfo.InvariantCulture);
default:
return "Type " + typeName + " not implemented yet; this will fail the client assertion.";
}
}
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:33,代码来源:BasicService.svc.cs
示例20: Populate
void Populate (JsonValue json, RootElement root, JsonValue data)
{
if (json.ContainsKey(Constants.Title))
root.Caption = json[Constants.Title];
JsonValue jsonRoot = null;
try {
jsonRoot = json[Constants.Root];
} catch (Exception){
Console.WriteLine("Bad JSON: could not find the root element - "+json.ToString()) ;
return;
}
if (json.ContainsKey(Constants.DataRoot)){
var dataroot = json[Constants.DataRoot].CleanString();
if (data!=null && data.ContainsKey(dataroot))
data = data[dataroot];
}
foreach (JsonObject section in jsonRoot){
var sec = new FormSectionBuilder(this._controller).Build(section, data);
foreach (var el in sec.Elements) {
if (!string.IsNullOrEmpty(el.ID) && !_elements.ContainsKey(el.ID)) _elements.Add(el.ID, el);
}
root.Add(sec);
}
}
开发者ID:goneflyin,项目名称:MonoMobile.Forms,代码行数:28,代码来源:FormBindingContext.cs
注:本文中的System.Json.JsonValue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论