json数组

以下是为您整理出来关于【json数组】合集内容,如果觉得还不错,请帮忙转发推荐。

【json数组】技术教程文章

javascript – jQuery .getJSON返回数组变量&json数组操作【代码】

有没有办法让$.getJSON返回变量数组?我知道它的异步和超出范围,但我会在ajax回调中使用它,我只需要先获取所有值并检查它们与另一个数组. 就像是:$.getJSON('itemManager.php?a=getItems', function(data){// itemArray = new Array(data);// idsArray = new Array(data.id);for (var i in someOtherArray){if($.inArray(i, idsArray) == -1){// do something...// get jason variable by id?// itemArray[i].someVariable}} }编辑...

c# – 如何反序列化仅包含值的JSON数组?【代码】

我从Web功能获得此结果.["767,20150221122715,121053103,14573465,1,7,302", "767,20150221122756,121053165,14573375,1,0,302", "767,20150221122840,121053498,14572841,1,12,124"]通常Json有PropertyName:Value但是这有一个字符串数组,每个字符串都有以逗号分隔的值.我知道每个价值位置意味着什么. 我尝试使用JsonConvert.DeserializeObject但无法使其工作.string deserializedProduct = JsonConvert.DeserializeObject<string...

java – GSON.如何将json对象转换为json数组?【代码】

现在我从API获取这个JSON:{"supplyPrice": {"CAD": 78,"CHF": 54600.78,"USD": 20735.52}}但价格是动态的,这就是为什么我需要这种形式的JSON{"supplyPrice": [{"name": "CAD","value": "78"},{"name": "TRY","value": "34961.94"},{"name": "CHF","value": "54600.78"},{"name": "USD","value": "20735.52"}] }如何使用GSON做到这一点?解决方法:您需要迭代supplyPrice对象的所有键,并使用该键值创建New JSONArray,然后将新数组分...

java – 使用gson将json数组转换为android中的json对象?【代码】

我将一个json数组从活动A传递给活动B.然后我使用GSON库将值插入到数组中.这是我当前的代码.public void gsonResponse(String json) {try {JSONObject jsonObject = new JSONObject(json);JSONArray jsonArray = jsonObject.getJSONArray("result");for (int i = 0; i < jsonArray.length(); i++) {LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<>();JSONObject innerJosonObject = new JSONObject(jsonArray.g...

javascript – 在ASP.NET MVC中将原始json数组生成到视图中【代码】

我正在使用ASP.NET MVC,我正在尝试生成一段javascript作为视图呈现的一部分.我有一个公开一个简单类型数组的模型,我想在视图中生成一个javascript / json等效数组,以便我可以使用jQuery对它进行操作.所以给出以下模型:public class Info {public string Name {get;set;}public int ID {get; set;} }public class InfoModel{public Info[] InfoList {get;set;} }…我想生成一个如下所示的javascript数组:var infoList = [{Name = ...

无法反序列化当前的JSON数组(例如[1,2,3]). C#,无法找出错误【代码】

我正在尝试从以下json数据中检索所有名称并将其放在文本框中. 这是我缩短了一些值的json数据,使其更易于阅读,但它不会影响问题.[{ "id": "LEA", "name": "Limited Edition Alpha", "block": null, "type": "Core", "description": "The name Alpha refers to the first print run of the \n original Magic: The Gathering Limited Edition, the first Magic: The Gathering \n card set. It premiered in a limited release at ...

按月对PHP JSON数组进行排序【代码】

我试图通过MONTH名称缩短数组.[ { "order_id":34,"user_id":17,"sum":65000,"month":"May"},{ "order_id":32,"user_id":19,"sum":15000,"month":"July"},{ "order_id":29,"user_id":1,"sum":20000,"month":"April"} ]有什么方法可以快速排序吗?我需要名字格式的月份. 我期待一个像下面这样的结果.[ { "order_id":29,"user_id":1,"sum":20000,"month":"April"},{ "order_id":34,"user_id":17,"sum":65000,"month":"May"},{ ...

java – 使用Jackson和WebClient将json数组反序列化为对象【代码】

在使用Spring反序列化json数组时遇到问题.我从服务中获得了这个json响应:[{"symbol": "XRPETH","orderId": 12122,"clientOrderId": "xxx","price": "0.00000000","origQty": "25.00000000","executedQty": "25.00000000","status": "FILLED","timeInForce": "GTC","type": "MARKET","side": "BUY","stopPrice": "0.00000000","icebergQty": "0.00000000","time": 1514558190255,"isWorking": true},{"symbol": "XRPETH","orderId"...

javascript – 从Angular 5中的本地文件到Typescript数组的JSON数组【代码】

我正在使用Angular 5开发一个Web应用程序.我有JSON文件,如下所示:[{"id": 0,"title": "Some title"},{"id": 1,"title": "Some title"},... ]该文件存储在本地.我也有一个界面:export interface Book {id: number;title: string; }问题是我如何: >从文件中获取数据?>从这些数据创建一个Book []类型的数组?解决方法:您可以使用import加载文件:import data from 'path/to/data.json';并将其分配给Book []类型的数组:@Component...

php – 有没有比从foreach获取JSON数组值更快的方法?【代码】

我有一个像这样的JSON数组:[{"location":"1","distance":"25.75206"},{"location":"2","distance":"21.49343"},{"location":"3","distance":"24.13432"} ]现在我正在使用每个$location来获取相应的数据.$locations = json_decode($locations, true);foreach ($locations as $key => $value) {if ($value['location'] == $location) {$distance = $value['distance']; } }问题是,数组可能非常大,有几千个项目,所以做一个foreach是非...