Tag: json

C#JSON.NET – 反序列化使用不寻常的数据结构的响应

我有一些麻烦找出一个干净(尽可能)的方式来反序列化一些特定格式的JSON数据。 我想反序列化数据到强types的数据对象类,非常灵活的具体细节。 以下是数据的例子: { "timestamp": 1473730993, "total_players": 945, "max_score": 8961474, "players": { "Player1Username": [ 121, "somestring", 679900, 5, 4497, "anotherString", "thirdString", "fourthString", 123, 22, "YetAnotherString"], "Player2Username": [ 886, "stillAstring", 1677, 1, 9876, "alwaysAstring", "thirdString", "fourthString", 876, 77, "string"] } } 我不确定的具体部分是: 球员的收集会被视为字典吗? 用户名可以作为键,但是这个值会把我扔掉,因为它是一个string和整数值的混合集合。 玩家完全由未命名的值组成。 我几乎一直使用名为属性和值的JSON数据(例如,时间戳,total_players等在顶部) 说我有这样的顶级课程: public class ScoreboardResults { public int timestamp { get; […]

什么是一个Ajax调用响应像“for(;;); {json data}“是什么意思?

可能重复: 为什么人们把代码如“扔1; 在json响应面前,“<dont be evil>”和“for(;;);” 我发现这种在Facebook上用于Ajax调用的语法。 我困惑于for (;;); 部分在响应的开始。 它是干什么用的? 这是呼吁和回应: GET http://0.131.channel.facebook.com/x/1476579705/51033089/false/p_1524926084=0 响应: for (;;);{"t":"continue"}

如何保存Backbone.js模型数据?

我更加注重前端开发,最近开始将Backbone.js浏览到我的应用程序中。 我想将模型数据保存到服务器。 你能否解释我保存模型数据的各种方法(使用json格式)。 我在服务器端使用Java。 另外我主要看到REST被用来保存数据。 由于我更多的是前端开发,我不知道REST和其他类似的东西。 如果有人能够用一个简单的例子来解释我的过程,那将是非常好的。

从Webservice(asmx)加载数据到jqgrid。 请帮帮我

我创build一个样本来testingjqgrid。 GetDataService.asmx: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Xml.Linq; using System.Web.Script.Services; using System.Web.Script.Serialization; using System.Collections.Generic; using System.Data.SqlClient; namespace ExampleJqGrid { /// <summary> /// Summary description for GetDataService /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] [ToolboxItem(false)] // To allow this Web Service to […]

:无法识别的select器发送到实例

我想parsing一个Json文件到表视图,我得到这个错误 [__NSCFDictionary objectAtIndex:]:无法识别的select器发送到实例,应用程序崩溃。 请帮助我,我是iOS开发新手。 我的代码 @implementation ViewController – (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } – (void)viewDidLoad { self.title = @"Feeds"; [super viewDidLoad]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; NSURL *url = [NSURL URLWithString:@"http://little-people.blogspot.com/feeds/posts /default?alt=json"]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; […]

JSONObject:为什么JSONObject改变属性的顺序

我正在尝试使用JSON对象构造一个JSONstring 我想要这样构buildJSONstring { "Level": "3", "Name": "testLogger", "IPADDRESS": "testMachiene", "Message": "hiiiiiiiiii", "TimeStamp": "test12345678" } 这是我的简单程序 package com; import org.json.JSONObject; public class Teste { public static void main(String args[]) throws Exception { int loglevel = 3; String loggerName = "testLogger"; String machieneName = "testMachiene"; String timeStamp = "test12345678"; String message = "hiiiiiiiiii"; JSONObject obj = new […]

我怎样才能parsing这个Android的JSON?

我想拉出用户块。 JSON结果总是会改变,有时会有4个用户返回,有时候会有10个。 { "results": [ { "user": { "avatar_url_thumb": "http://avatars.stocktwits.com/production/9998/thumb-1270014645.png?1270014645", "avatar_url_medium": "http://avatars.stocktwits.com/production/9998/medium-1270014645.png?1270014645", "created_at": "2010-03-15T05:44:51Z", "following_count": 14, "updated_at": "2010-08-30T18:22:15Z", "id": 9998, "updates_count": 31, "avatar_url_large": "http://avatars.stocktwits.com/production/9998/large-1270014645.png?1270014645", "investor_relations": false, "last_name": "Reporter", "followers_count": 25, "recommended": false, "bio": "Apple News & AAPL Stock Analysis, visit Apple Digest blog link above", "login": "AppleReporter", "first_name": "Apple" } }, { "user": { "avatar_url_thumb": […]

如何阅读JSON结果在jQuery中?

我不熟悉jQuery。 你能帮我吗? 我有一个JSON从URL的响应,但我不知道如何,我可以读取jQuery中的键值。 例如,如何获得“HAWBItemEntity”值? 请检查下面的json响应。 { "waybill_log": { "TrackingResult": { "HAWBEntity": { "HAWBID": 282829899, }, "HAWBHistoryEntity": [ { "ActionDate": "4/26/2014 12:32:00 PM", }, { "ActionDate": "4/26/2014 12:32:00 PM", } ], "HAWBAttachmentEntity": [ { "FileName": "Invoice_30018018516..pdf", } ], "HAWBItemEntity": null, }, "HAWBAttachmentEntityExtendedList": [ { "HAWBAttachmentEntity": { "FileName": "Invoice_30018018516..pdf", }, "AttachmentLink": "nw" } ], "CurrentStatus": "Delivery", "ConsolsData": […]

如何从json对象中删除所有空值和空string值?

你能告诉我如何从json对象中删除所有null和空string值吗? 我在删除密钥时出错。 这是我到目前为止,但它不能正常工作: $.each(sjonObj, function(key, value) { if(value == "" || value == null) { delete sjonObj.key; } }); var sjonObj= { "executionMode": "SEQUENTIAL", "coreTEEVersion": "3.3.1.4_RC8", "testSuiteId": "yyy", "testSuiteFormatVersion": "1.0.0.0", "testStatus": "IDLE", "reportPath": "", "startTime": 0, "durationBetweenTestCases": 20, "endTime": 0, "lastExecutedTestCaseId": 0, "repeatCount": 0, "retryCount": 0, "fixedTimeSyncSupported": false, "totalRepeatCount": 0, "totalRetryCount": 0, "summaryReportRequired": "true", "postConditionExecution": […]

为什么eval('('+ jsonString +')')在parsingjsonstring时需要打开引号和括号

你能告诉我这个特定的语法结构的原因吗? eval('(' + jsonString+ ')') parsingjson文本时。 克罗克福德说:“ 文本必须包装在parens中,以避免绊住JavaScript语法的歧义 。” 这里 。 这意味着什么? 我们可以避免吗?