Tag: json

json_encode()转义正斜杠

我从Instagram上拉JSON: $instagrams = json_decode($response)->data; 然后将variablesparsing到一个PHP数组中,重新构造数据,然后重新编码和caching文件: file_put_contents($cache,json_encode($results)); 当我打开caching文件时,所有正斜杠“/”都被转义: http:\/\/distilleryimage4.instagram.com\/410e7… 我从我的search中收集json_encode()自动执行此操作…是否有办法禁用它?

将具有循环引用的JavaScript对象string化(转换为JSON)

我有一个包含循环引用的JavaScript对象定义:它有一个引用父对象的属性。 它也有我不想传递给服务器的function。 我将如何序列化和反序列化这些对象? 我读过最好的方法是使用Douglas Crockford的stringify。 不过,我在Chrome中收到以下错误: TypeError: Converting circular structure to JSON 代码: function finger(xid, xparent){ this.id = xid; this.xparent; //other attributes } function arm(xid, xparent){ this.id = xid; this.parent = xparent; this.fingers = []; //other attributes this.moveArm = function() { //moveArm function details – not included in this testcase alert("moveArm Executed"); } } function […]

是否有一个JSONparsing器VB6 / VBA?

我正在尝试在VB6中使用Web服务。 我所控制的服务当前可以返回SOAP / XML消息或JSON。 我有一个非常困难的时间搞清楚,如果VB6的SOAPtypes(版本1)可以处理返回的object – 而不是简单的types,如string , int等等。到目前为止,我不知道我需要做什么来获得VB6玩返回的对象。 所以我想我可能会将该服务中的响应序列化为JSONstring。 对于VB6是否存在JSONparsing器?

无法使用Json序列化Web API中的响应

我正在使用ASP.NET MVC 5 Web Api。 我想咨询我所有的用户。 我写:api / users和我收到这个: “'ObjectContent`1'types未能序列化内容types'application / json; charset = utf-8'的响应主体 在WebApiConfig中,我已经添加了这几行: HttpConfiguration config = new HttpConfiguration(); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType); config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; 但仍然不起作用 我的函数返回数据是这样的: public IEnumerable<User> GetAll() { using (Database db = new Database()) { return db.Users.ToList(); } }

使用Underscore for Javascript删除重复的对象

我有这样的数组: var foo = [ { "a" : "1" }, { "b" : "2" }, { "a" : "1" } ]; 我想过滤它有: var bar = [ { "a" : "1" }, { "b" : "2" }]; 我尝试使用_.uniq,但我猜是因为{ "a" : "1" }不等于自己,它不起作用。 有没有办法提供一个重写等于函数的下划线uniq?

在TSQL中parsingJSON

是否有可能在TSQLparsingJSON? 我不是说要创build一个JSONstring,我的意思是parsing一个JSONstring作为参数传入。

如何将Joda DateTime与Jackson JSON处理器序列化?

我如何让jackson根据一个简单的模式(如“dd-MM-yyyy”)序列化我的Joda DateTime对象? 我试过了: @JsonSerialize(using=DateTimeSerializer.class) private final DateTime date; 我也试过: ObjectMapper mapper = new ObjectMapper() .getSerializationConfig() .setDateFormat(df); 谢谢!

Android-创buildJSON数组和JSON对象

我如何在Android中使用这种格式创buildJSON:由于我将传递的API将parsingJsonArray,然后parsing对象。 或者,如果只是传递一个json对象,它会好吗? 因为我只需要为每个服务调用插入一个事务。 { "student": [ { "id": 1, "name": "John Doe", "year": "1st", "curriculum": "Arts", "birthday": 3/3/1995 }, { "id": 2, "name": "Michael West", "year": "2nd", "curriculum": "Economic", "birthday": 4/4/1994 } ] } 我知道的只是JSONObject。 像这个。 JSONObject obj = new JSONObject(); try { obj.put("id", "3"); obj.put("name", "NAME OF STUDENT"); obj.put("year", "3rd"); obj.put("curriculum", "Arts"); obj.put("birthday", "5/5/1993"); […]

如何获得对象的长度

有没有可以返回一个对象的长度的内置函数? 例如,我有a = { 'a':1,'b':2,'c':3 }应该返回3 。 如果我使用a.length则返回undefined 。 这可能是一个简单的循环函数,但我想知道是否有一个内置函数? 有一个相关的问题( JSON对象的长度 ) – 在select的答案中,用户build议将对象转换为数组,这对我的任务来说不是很舒服。

什么是$ $$ hashKey添加到我的JSON.stringify结果

我曾尝试寻找他们的文档的Mozilla JSON stringify页面以及SO和Google的这里,但没有find任何解释。 我已经使用JSOn很多时间,但从来没有遇到过这个结果 我有一个JSON对象的数组 [ { "param_2": "Description 1", "param_0": "Name 1", "param_1": "VERSION 1" }, { "param_2": "Description 2", "param_0": "Name 2", "param_1": "VERSION 2" }, { "param_2": "Description 3", "param_0": "Name 3", "param_1": "VERSION 3" } ] 附加到我的$scope和为了发布他们作为一个参数我使用JSON.stringify()方法,我得到以下内容: [ { "param_2": "Description 1", "param_0": "Name 1", "param_1": "VERSION 1", "$$hashKey": "005" }, […]