本文整理汇总了C#中System.Json.JsonValue类的典型用法代码示例。如果您正苦于以下问题:C# JsonValue类的具体用法?C# JsonValue怎么用?C# JsonValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonValue类属于System.Json命名空间,在下文中一共展示了JsonValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewResultRow
/// <constructor />
public ViewResultRow(JsonValue key, JsonValue value, string documentId, Document document)
{
Key = key;
Value = value;
DocumentId = documentId;
Document = document;
}
示例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);
};
}
示例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;
}
示例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;
}
示例5: Initalize
public static EditTournamentStateDialog Initalize(JsonValue _json, Activity _context)
{
var dialogFragment = new EditTournamentStateDialog();
dialogFragment.json = _json;
dialogFragment.context = _context;
return dialogFragment;
}
示例6: RelationshipUser
public RelationshipUser(JsonValue json)
{
Id = json["id"];
ScreenName = json["screen_name"];
IsFollowing = json["following"];
IsFollowedBy = json["followed_by"];
}
示例7: displayString
private string displayString(JsonValue input)
{
string s = input.ToString ();
int l = s.Length-2;
string output = s.Substring(1, l);
return output;
}
示例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>();
}
示例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++];
}
示例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();
}
示例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;
}
示例12: ClassDefiniation
public ClassDefiniation(string propertyName, JsonValue jValue, StringBuilder sb, string classHeadser)
{
PropertyName = propertyName;
JValue = jValue;
StringBuilder = sb;
ClassHeader = classHeadser;
}
示例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"]);
}
示例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;
}
示例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;
}