json

Get parent and grandparent keys from a value inside a deep nested object [closed]

给你一囗甜甜゛ 提交于 2021-02-08 12:05:37
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I’ve got a deep nested JavaScript Object and I know a value which is at the object’s lowest position. I want to know the parent key and grandparent key. I set up a jsbin https://jsbin.com/yimugezuxe/edit?js,console Based on the value 'uniqueID#9aserdf' I want

How to decode json, group by a column value, and sum values in each group?

試著忘記壹切 提交于 2021-02-08 12:02:55
问题 I have data in MySQL. The data is created by json datas. But I can't change to array from data keys. I want to set this data in order and according to the number of stock. [ {"size":"36","stock":"1"}, {"size":"37","stock":"2"}, {"size":"38","stock":"1"}, {"size":"40","stock":"1"}, {"size":"36","stock":"1"}, {"size":"37","stock":"3"}, {"size":"38","stock":"2"}, {"size":"39","stock":"3"}, {"size":"40","stock":"2"} ] I want change to: array( '36' => '2', '37' => '5', '38' => '3', '39' => '3',

How to read json folder data using Python?

亡梦爱人 提交于 2021-02-08 11:57:53
问题 I want to get the data of json folders using Python 3.7.2. This is my json file: {"device": [ {"name": "device1", "status": 0}, {"name": "device2", "status": 1}, {"name": "device2", "status": 1} ] } For my project I need following variables: variable of all devices gathered in a list: devices = ["device1", "device1", "device1"] status of devices saved in different variables: status_device1 = 0 status_device2 = 1 status_device3 = 1 It is possible to change the structure of the json file, but

I can not get http request to work on android 10 api 29 or api 30. It does work with lower apis though

荒凉一梦 提交于 2021-02-08 11:53:23
问题 I'm writing an Android shopping app using the Telerik NativeScript platform. I need to get the client details for orders and deliveries, so I get them to register on the initial startup. The app works on APIs 17 up to API 28, I don't know what is stopping it from working on API 29 and API 30. If I can't get this to work, I will not get the sending of orders back to the web application to work either. The code:- const Observable = require("tns-core-modules/data/observable").Observable; const

get the data from web service response in retrofit android

三世轮回 提交于 2021-02-08 11:52:26
问题 i am working on retrofit from four days. I learnt how to get the data from web service but now i stuck with this response. please any one tell me how to get the data from web service. how to get the operator id,operator, RechareTypes array of strings. Please any one help me. Thanks in advance. my code: operator: public class Operator { @Expose private String OperatorID=""; @Expose private String ServiceTypeID=""; public String getServiceTypeID() { return ServiceTypeID; } public void

Find object by property in JSON array

大城市里の小女人 提交于 2021-02-08 11:47:27
问题 I have problem with get string in JSON data. Format as below: [ { "name": "Alice", "age": "20" }, { "id": "David", "last": "25" }, { "id": "John", "last": "30" } ] Sometime it changes position together, John from 3rd place go to 2nd place: [ { "name": "Alice", "age": "20" }, { "name": "John", "age": "30" }, { "name": "David", "age": "25" } ] If i use data[3].age to get John 's age, and data change position, I will get David 's age. Is there any method I can use to find the object with name

convert xls to json in python

ε祈祈猫儿з 提交于 2021-02-08 11:45:24
问题 I am trying to convert xls to json and but when I am executing the code it's not giving me the data inside xls sheet, it's only giving me the json structure. Below is the code which I am running, I am not able to understand what modification I should further make in this so that I can get a perfect json file. Please note - input is in the form of binary stream and output is also in the form of a stream and not file. #!/usr/bin/python -u import sys import xlrd import simplejson from

Exclude the JSON property only if it exists - Powershell

烈酒焚心 提交于 2021-02-08 11:41:24
问题 I have two different JSONs and I would like to remove streets from the JSON object if only it exists under Address which is an array. I am trying to do this in powershell. I can get my script working and remove the streets but I only want to run the exclude line of command if the address has the streets property. { "Customer": [{ "id": "123" }], "address": [{ "$type": "Home", "name": "Houston", "streets": [{ "name": "Union", "postalCode": "10" }] }, { "$type": "Office", "name": "Hawai",

JSON_decode problem with array posted to CodeIgniter

主宰稳场 提交于 2021-02-08 11:41:08
问题 I am certain I am making a simple mistake... but simply can't find it. Ultimately I am posting a JSON array from an Android app (that part is working), but for the time being I am simply testing between two PHP pages (1: test PHP page with basic form, and 2: the CodeIgniter final destination) Here is what I have: At the form page: <form action="bambooinvoice/index.php/api2/newinvoice/4/0/0" method="post"> <?php $array = array("items"=>array( "taxable"=>1, "quantity"=>1, "amount"=>123.99,

Spring MVC + Ajax JSON post

你离开我真会死。 提交于 2021-02-08 11:20:26
问题 I have a problem with send JSON to the Controller . I can't understand my problem. So, url - /notes/{username}/add Ajax : $.ajax({ type: "POST", contentType : 'application/json; charset=utf-8', dataType : 'json', url: window.location.pathname, data: JSON.stringify({ title: $("#title").val(), text: $("#text").val() }), success : function() { $("#title").val(""); $("#text").val(""); } }); Controller : @RequestMapping(value = "/{username}/add", method = POST) public void add(@RequestBody Note