FAQ Database Discussion Community


why i don't get return value javascript

javascript,jquery,html,json,html5
When i debug my code i can see i have value but i don't get value to createCheckBoxPlatform FN function createCheckBoxPlatform(data) { var platform = ""; $.each(data, function (i, item) { platform += '<label><input type="checkbox" name="' + item.PlatformName + ' value="' + item.PlatformSK + '">' + item.PlatformName + '</label>' +...

How use jquery getJSON with a local variable

javascript,jquery,ajax,json,ace-editor
i want to extend the completions of Ace Editor, and i need a json of word, this is my code: function load_completions() { var object = $('#preview').attr('class'); $.ajax({ type: "POST", url: "test_editor_ajax.php", data: {action:'load_completion', object:object}, cache: false, success: function(json){ var adminCompleter = { getCompletions: function(editor, session, pos, prefix, callback) {...

Sencha/Extjs rest call with all parameters

json,rest,extjs,sencha-touch
I'm using ExtJs 5.1.1 and I've written a simple view with a grid, and selecting one row the corresponding model property are editable in some text fields. When editing is completed the button 'save' call Model.save() method, which use the rest proxy configured to write the changes on the server....

python - using json with OrderedDict and Datetime

python,json
I am using python to encode an OrderedDict with timestamp in it and I am having issues. The data that I am trying to encode looks like this: OrderedDict([('a', datetime.datetime(2015, 6, 15, 15, 58, 54, 884000)), ('b', 'b'), ('c', 'c'), ('d', 'd')]) I expect this to be json encoded and...

access the json encoded object returned by php in jquery

php,jquery,ajax,json
I want to post some data to php function by ajax, then get the encoded json object that the php function will return, then I want to get the information (keys and values) from this object, but I don't know how, here is my code: $.ajax({ url: "functions.php", dataType: "JSON",...

Generating HTML list from JSON array

javascript,jquery,html,json,angularjs
Using angularJS I'm trying to build a list that will be used as a menu. I have an array of JSON and the menu must be built depending on conditions on JSON fields : In my controller, for now, I have this : Getting the JSON : $scope.cartoList = [];...

Fatal error catched by register_shutdown_function and update json_encode

php,json,fatal-error
I can catch a fatal error with register_shutdown_function('shutdown') function shutdown(){ $error = error_get_last(); $result['message'] = $error['message']; } and I have an echo json_encode($result); Unfortunately this echo json_encode shows nothing because json is not updated with the message of the fatal error. What can I do to fix this?...

Accessing JSON object in SAPUI5 via xsodata

javascript,json,odata,sapui5
I try to access the value of my json objects in sap ui5, but the getproperty function cannot access the required data. But, at first, I have created a xsodata file with some service definitions, e.g. "CUSTOMER_ATTR_G3" as "Customers"; Then I try to get these data in view.js file with...

Parse JSON output from AlamoFire

json,swift,nsurlrequest
I am using the latest Alamofire to manage a GET http request to my server. I am using the following to GET and parse the JSON: Alamofire.request(.GET, "*******") .responseJSON {(request, response, JSON, error) in if let statusesArray = JSON as? NSArray{ if let aStatus = statusesArray[0] as? NSDictionary{ //OUTPUT SHOWN...

What's the best way to map objects into ember model from REST Web API?

json,rest,ember.js,asp.net-web-api,ember-data
The topic of this post is: my solution is too slow for a large query return. I have a Web Api serving REST results like below from a call to localhost:9090/api/invetories?id=1: [ { "inventory_id": "1", "film_id": "1", "store_id": "1", "last_update": "2/15/2006 5:09:17 AM" }, { "inventory_id": "2", "film_id": "1", "store_id":...

Sorting in Ruby on rails

ruby-on-rails,json,sorting
I'm very new to Ruby on rails. I try to edit the following api. I want to sorting "can_go" which is true are shown at the top of list. I added this row before sending data, but the result is still order by "user_id". user_infos.sort { |a, b| - (a['can_go']<=>b['can_go'])...

PHP how to extract info from json string wtihout knowing the keys

php,json
I am querying a service if a person have phone number(s) (also maybe not). I have a json string (as return value) like the following: $json = '{"data":[{"tel1":"1102"},{"tel2":"3220"}],"found":true}'; I convert this string to json_decode() function. $jd = json_decode($json); Then I want to get the phone numbers only into an array...

String comparison in AngularJS

javascript,json,angularjs,ionic-framework,string-comparison
I'm trying to compare two strings in AngularJS, and I've seen examples online. As I understand it, you can use angular.equals(str1, str2), you can use ===, you can use == if you're sure that both are strings... I've tried all three, but I don't get the result. Something must be...

break looping in json jquery

javascript,php,jquery,json
how can I break for looping in get json jquery when the condition has reached the right value? I've tried to set variable inside json query code then break it, but it cannot read the variable when the variable is outside of json query code. is there any possible to...

Why i get can not resolve method error in class android?

android,json
I use this tutorial: JSON and part of code to this: protected String doInBackground(String... urls) { TextView lbl=(TextView) findViewById(R.id.provCODE); person = new Person(); person.setName(lbl.getText().toString()); //person.setCountry("1853"); //person.setTwitter("1892"); return POST(urls[0],person); } but in the this line: person.setName(lbl.getText().toString()); i get this error: Can not resolve method. How can i solve that?what happen? my...

Response 200 OK but Jquery shows error?

javascript,jquery,json
I am stuck in kind of a weird problem where I am trying to make a JSONP request to the Open Weather history API to get the weather information for the previous years on the a particular date. fetchHistoryUrl = 'http://78.46.48.103/data/3.0/days?day=0622&mode=list&lat=39.77476949&lon=-100.1953125'; $.ajax({ method: 'get', url: fetchHistoryUrl, success: function(response){ console.log(response); },...

Jackson - Extract Data without Brackets, Commas, and =?

java,json,object,jackson,jackson-modules
I don't know a ton about Jackson, I'm just using it because I needed to share data from Python to Java. Anyway my code is pretty simple ObjectMapper mapper = new ObjectMapper(); Map<String,Object> data = mapper.readValue(new File(FileName), Map.class); System.out.println(data.get("SomeInput")); This is what I'm getting: {Y=0.830168776371308, Z=0.16877637130801687, X=0.0010548523206751054} I really just...

Parsing datetime in python json loads

javascript,python,json,datetime
I want to parse (json.loads) a json string that contains datetime values sent from a http client. I know that I can write a custom json encoder by extending the default encoder and overriding the default method class MyJSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, (datetime.datetime,)): return obj.isoformat() elif isinstance(obj, (decimal.Decimal,)):...

Trying to get property of non-object (valid json) [duplicate]

php,json,object
This question already has an answer here: How can I access an array/object? 3 answers Just a real quick question please, I have this string that came from my query I am able to display the string using xx = dd($sumx) which gave me the string below: string(124) "[{"total":-4107717.58,"alerx":4,"currentYear":-4107717.58,"lastYear":0,"date":2015,"value":{"debit":0,"credit":4107717.58}}]"...

json_decode returns NULL, json_last_error throws 0

php,ajax,json
I'm passing a simple JSON array with 4 words to PHP. I want to store that array in a database after I serialize it. Since it's an Ajax call I can only investigate any echoed values by json_encode and alerting them in AJAX success function. Here's my code: var jsonString...

How to open WebView through the onListItemClick (using Volley/JSON)?

android,json,listview,webview
I made a blog reader using Volley. I created WebView to show articles (open WebView with article) when you push on a List, but I have a problem with using onListItemClick. The problem is: Base on what I learned I should put the "name" of JSONArray, but the problem is,...

Saving to a database using a Nokogiri (json?) rake task

ruby-on-rails,ruby,json,nokogiri
RoR noob here! I have a rake task doing what I want to do I am just stuck on how to get the results saved to my language table. I want the results from this rake task to populate the values of the language field on my language table. I'm...

Serializing a java bean into a cookie: Is it bad?

java,json,cookies
In the organization that i work for, there was a serious debate about the following. Scenario: There is a POJO with 6 different properties all are of type Strings. These values need to be persisted as cookies so that it can be picked back when someone does a booking on...

Check for duplicates in JSON

javascript,jquery,json,duplicates
I have a json object: var object1 = [{ "value1": "1", "value2": "2", "value3": "3", }, { "value1": "1", "value2": "5", "value3": "7", }, { "value1": "6", "value2": "9", "value3": "5", }, { "value1": "6", "value2": "9", "value3": "5", }] Now I want to take each record out of that...

KendoUI Grid - Complex JSON with inconsistent keys

javascript,json,kendo-ui,kendo-grid
I know this is probably been asked before, but having tried to find an answer - I am guessing either I am not comprehending some of the answers right, or I am looking at the problem all wrong. I am using a complex SLC loopback query - and the api...

Simple java library to deserialise json to a java object using getters/setter and not properties(GSON)

java,json,deserialization
I am currently working on a REST based application and need to convert a json object to a class. The problem is that class is from a third party library and I do not have access to the source file. Further the properties in the java object does not match...

Table has no column in google charts and php

php,json,google-visualization
i need help with my google chart...i currently have a getdata.php which has a query with information from my DB table..i have a page that enables one to select a particular user, once the user is selected i use the &_GET option to get an ID and feed it into...

adding json results to javascript list

javascript,jquery,arrays,json
I have created a script to call a page, which returns a list of date strings via JSON. How do i add these dates to an array that i've created? var bookedDates= []; $(document).ready(function () { $.ajax({ url: "/Ajax/getBooked", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) {...

Python3 requests module or urllib.request module both retrieving incomplete json

python,json,python-requests
I'm doing some scraping and looking at pages like this one (https://www.endomondo.com/rest/v1/users/20261627/workouts/526622897), but I have not been able to fully retrieve the JSON content.I have tried using both of the following sets of code, but each returns an incomplete JSON object: url = 'https://www.endomondo.com/rest/v1/users/%s/workouts/%s'%(string_use_user, string_use_workout) print(url) response = urlopen(url) try:...

jquery append() is creating two div elements

javascript,jquery,json,angularjs,jquery-ui
I am adding div elements dynamically to the DOM using jquery append(). I have made a controller that takes json data using $http.get() and calls a function create_mission to add the divs to DOM. I have to create a div for every object of the json, so i have done...

Ignoring incoming json elements in jax-rs

json,jaxb,jax-rs
I'm wondering where to put the @JsonIgnoreProperties(ignoreUnknown = true) in a Java REST API. I have the following class: import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.map.ObjectMapper; @JsonIgnoreProperties(ignoreUnknown = true) public class QueuePayload { private String message; private String id; public String getId() { return this.id; } public String getMessage() { return this.message; }...

How to rearrange CSV / JSON keys columns? (Javascript)

javascript,json,csv,papaparse
I am converting a JSON object array to CSV using Papa Parse JavaScript Library. Is there a way to have the CSV columns arranged in a certain way. For e.g; I get the column as: OrderStatus, canOp, OpDesc, ID, OrderNumber, FinishTime, UOM, StartTime but would like to be arranged as:...

How to save a json file locally with dojo toolkit

javascript,android,json,eclipse,dojo
I'm trying to create a JSON file with dojo toolkit that need to be saved into local memory of the phone. The app need to be valid for android and IOS. I'm using ECLIPSE with ADT as a IDE. My principal issue is that normally the file created with dojo...

convert JSON array to Ruby Hash (of hashes)

ruby,json
I'm trying to convert some API response data into a Ruby hash or array so I can more easily work with it. Here's the JSON string being returned by the API: [ { "id": 2, "name": "TestThing", "token": "B2CA27221DB976E48248F26756289B91" }, { "id": 3, "name": "AnotherTestThing", "token": "EF16E5F20B8463E48DBF3BA8F0E1102A" } ] I...

Create n:m objects using json and sequelize?

javascript,json,node.js,sequelize.js
I am trying to learn sequelize, but am having trouble getting a n:m object created. So far I have my 2 models that create 3 tables (Store, Product, StoreProducts) and the models below: models/Store.js module.exports = (sequelize, DataTypes) => { return Store = sequelize.define('Store', { name: { type: DataTypes.STRING, },...

Swift 2 : NSData(contentsOfURL:url) returning nil

ios,json,xcode,foundation,swift2
I have a webpage address which contains a JSON file. I'm trying to access the JSON file as NSDictionary in Swift 2. Every time I call NSData(contentsOfURL:url!) where url is type of NSURL?, it returns nil. I'm using Xcode 7 Beta, and the project was first made in Xcode 6....

LineChart with C3 using JSON

json,c3
I can't understand because my chart is not working properly. Anything is displayed. Below my simple code: <div id="chartc3"></div> <script> var scene; $.getJSON('assets/json/chartc3.json', function(data) { scene=data; var chart = c3.generate({ bindto: '#chartc3', data: { json: scene, keys: { value: ['round','val'], } } }); }); </script> and the following json file:...

do calculation inside JSONArray in Java

java,arrays,json
I have a simple issue but cannot solve it as I am not very good at algorithm! I have an JSONArray in this form: [{"values":[{"time":1434976493,"value":"50"}, {"time":1434976494,"value":"100"}],"counter":"counter1"}, {"values":[{"time":1434976493,"value":"200"}, {"time":1434976494,"value":"300"}],"counter":"counter2"}, {"values":[{"time":1434976493,"value":"400"}, {"time":1434976494,"value":"600"}],"counter":"total"}] What I want to do is to get the integer value for counter 1 and counter 2 and then divide...

Insert data in collection at Meteor's startup

javascript,json,meteor,data,startup
I would like to insert data at Meteor's startup. (And after from a JSON file) At startup, I create a new account and I would like to insert data and link it to this account once this one created. This is the code that creates the new account at startup:...

Providing implicit value for singletons in Play Json library

json,scala,playframework,scala-macros
I have following configuration: sealed trait Status case object Edited extends Status case object NotEdited extends Status case class Tweet(content:String, status:Status) I want to use Play Json format, so I guess I have to have something like this(I don't want to do it in companion object): trait JsonImpl{ implicit val...

Jackson @JsonUnwrapped behaviour with custom JsonSerializer

java,json,jackson
I have two classes like this: public class A { String aProp = "aProp"; public String getAProp() { return aProp; } } public class B { String bProp = "bProp"; A a = new A(); @JsonProperty("bProp") public String getBProp() { return bProp; } @JsonSerialize(using = CustomSerializer.class) public A getA() {...

Use JSON file to insert data in database

javascript,json,mongodb,meteor,data
I'm using my JSON file like this to insert data in my collection : var content = JSON.parse(Assets.getText('test.json')); console.log('inserting...'); Profiles.insert({ user: id, data:content }; But I would like to have a "data's tree" like that : [ user: "rtegert23423131", firstname:"test", surname:"test2", // ... ] Not like that : [ user:...

How can I get json objects without the object number?

javascript,jquery,json,rest
I have a simple json object that spits out 4 items that have completely different properties inside each one. I have got the json being displayed with the 4 objects that are called meta.work_content like so: [Object, Object, Object, Object] I can open these in console and see the objects...

JSON Date Formatting

jquery,json,date
I'm having an issue with the date format when getting JSON Date/Time. I've managed to get the date format to: 2009-06-25T17:32:10.0000000 But I need to be: 25/06/2009 17:32:10 But since I'm getting this data from a loop I've trouble finding out how exactly to format the date so that the...

Can't save json data to variable (or cache) with angularjs $http.get

json,angularjs,web-services,rest
I have weird angularjs problem. I'm trying to fetch data from Rest Webservice. It works fine, but I can't save json data to object. My code looks like: services.service('customerService', [ '$http', '$cacheFactory', function($http, $cacheFactory) { var cache = $cacheFactory('dataCache'); var result = cache.get('user'); this.getById = function(id){ $http.get(urlList.getCustomer + id).success(function(data, status,...

Angular: JSON filter in textarea produces a lot of slashes

javascript,json,angularjs,coffeescript
I have a problem, I have an object which needs to be editable via a textarea. The object is binded via ng-model with the textarea. Because it is JSON it is handy to have it parsed down to a nice style, so I used the json filter build in to...

Converting a list of options to a JavaScript arrary in C#

c#,json
I need to get a JSON string that looks like the following: {"1":[{"value":"1", "text":"Basketball"}, {"value":"2", "text":"Tennis"}, {"value":"3", "text":"Football"}],"3":[{"value":"4", "text":"futbol"}]} The C# code responsible for building this looks like the following: var sportsEntries = new Dictionary<byte, List<KeyValuePair<int, string>>>(); foreach (var department in Departments) { var deptOptions = SportList .Where(x => x.DeptId...

Ruby API Call Page Issue

ruby-on-rails,ruby,json,api,httparty
This might be a basic issue but very common so it might be helpful to other people in the future. I use HTTParty to make a get request to an API, which returns some information, something like this: { datapath: "blah-blah.blah.blah", success: true, info: { row_limit: 500, total_results: 2700, total_pages:...

JQuery mutiple post in the same time

javascript,php,jquery,json
I have three functions ,and every function post to special php page to get data.. and every function need some time because every php script need some time .. function nb1() { $.post("p1.php", { action: 1 }, function(data) { console.log(data); }, "json") .fail(function(data) { console.log("error"); }); } function nb2() {...

Parse JSON on PHP and extract the particular value(s)

php,mysql,json,parsing,logic
Objective: To parse following json string and get mentioned values separately, later those separated values are going to be inserted to mysql database. I have checked my json string on JsonLint user_name, selected_date, selected_project, tasks , 4.1.task_name, 4.2 work_hours { "user_name": "USER", "selected_date": "2015-06-08", "selected_project": "Project1", "tasks": [ { "task_name":...

How to return error messages in JSON with Bottle HTTPError?

python,json,bottle
I have a bottle server that returns HTTPErrors as such: return HTTPError(400, "Object already exists with that name") When I receive this response in the browser, I'd like to be able to pick out the error message given. As it is right now I can see the error message in...

How to parse JSON array of string arrays

c#,json
Lets say I get the following json data from a web service which I can't change. [ [ "Header1", "Header2", "Header3", "Header4" ], [ "FirstValue1", "FirstValue2", "FirstValue3", "FirstValue4" ], [ "SecondValue1", "SecondValue2", "SecondValue3", "SecondValue4" ] ] jsonlint.com tells me that it is valid json and from what I know I...

Parsing Google Custom Search API for Elasticsearch Documents

json,python-2.7,elasticsearch,google-search-api
After retrieving results from the Google Custom Search API and writing it to JSON, I want to parse that JSON to make valid Elasticsearch documents. You can configure a parent - child relationship for nested results. However, this relationship seems to not be inferred by the data structure itself. I've...

How do I loop through this Json object (angularJS)?

javascript,json,angularjs
I'm trying to loop through "tabs" in the Json object using AngularJS? How can I do it? var model = { "$id": "1", "tabs": [{ "$id": "2", "id": 2, "name": "Output", "layoutId": 1, "order": 1, "dashboardId": 1 }, { "$id": "15", "id": 3, "name": "Yield", "layoutId": 1, "order": 2, "dashboardId":...

How to get inner array values from json-array

java,android,json
This is the json response: [ { "currentvalue": [ { "id": "13", "current_value": "0,1", "create_date": "2015-06-15 06:12:14", "status": "0", "modify_date": "0000-00-00 00:00:00", "entry_time": "", "indicator_id": "13", "member_id": "9" } ], "target": { "notification_time": "06:12:14", "id": "13", "health_selected_days": { "day": "3" }, "point": "1", "indicator_name": "Test2", "create_date": "2015-06-15 06:12:14", "indicator_status": "0",...

Uncaught error: Invalid type for google table column

javascript,json,google-maps,google-visualization
I recently started using google visualization due to its simplicity. But while implementing in my recent project i seem to have run into a bit of trouble. The program shown is used to pull data from a JSON object and utilize it to display data in the google tables. Now...

My json is appearing as a HTML when parsed (android)

android,html,json,android-json
I'm trying to parse and get the values from a URL with JSON format. The format of the JSON when the URL is used in a browser is shown below: {"CompanyID":"1","Message":"Not active user","Success":"false","UserID":"2"} My JsonParser code is shown below: import android.util.Log; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import...

swift iterate on array

json,swift,for-loop
i would like to ask a little help. I have a method which call a webservice and get a json object from it. it's look like this way: func wsServiceFeedTst() { println("WS called...") println("tstFrames count: " + tstFrames.count.description) let json = JSON(url:"http://79.172.249.175:7001/RestWebServiceApp/webresources/entity.bkkkallerfeedtst") println(json) for (k, v) in json["bkkKallerFeedTst"] { let...

How to properly uplevel a json key in java? Why is the json not changing?

java,json
I have an array "myarray" like this: [{ name: John, age: { years:18 }, computer_skills: { years:4 }, mile_runner: { years:2 } }] How do I uplevel it properly? Using minimal-json, I do the following: JsonArray jsonArray = JsonArray.readFrom(myarray); for( JsonValue val : jsonArray) { JsonObject myObj = val.asObject(); for(...

Replace long integers in raw json with strings

c#,regex,json
I'm looking for a way to wrap all integers over 17 digits long in a json-formatted string in quotes (essentially making them strings when deserialized). Someone facing the same issue in Javascript posted here Convert all the integer value to string in JSON I suspect there is a way to...

Replacing elements in an HTML file with JSON objects

javascript,json,replace
I am writing some Javascript to: Read in and Parse a JSON file Read in an HTML file (created as a template file) Replace elements in the HTML file with elements from the JSON file. It is only replacing the first element obj.verb. Can someone please help me figure out...

Read JSON double dimensional array in Java

java,android,arrays,json
I'm trying to get a string from a JSONObject. My JSON looks like this : { "agent": [ {"name":"stringName1", "value":"stringValue1"}, {"name":"stringName2", "value":"stringValue2"} ] } I want to get the values from stringName1 and stringName2. So first, I tried to get the "agent" using this : JSONObject agent = (JSONObject) jsonObject.get("agent");...

Getting a JavaScript object into my controller: What am I missing here?

c#,asp.net,ajax,json,asp.net-mvc
I'm getting a 500 (Internal Server Error) when I try to run $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); return xhr; }, type: 'POST', url: [email protected]("MyAction","MyController")', data: fi, contentType: "application/json; charset=utf-8", dataType: "json", // dataType is json format success: function(retJson) { // ... } }); where fi is...

json_encode and parsing information if there are no records returned

php,ajax,json
I make some AJAX (PHP + JQuery), but I have one problem. I have: dataType:"json", in Javascript Everything works fine when json_encode returning some records from DB. The problem is what to do, how to say server in case that there are not any records? When I have an array...

How to get a sub parameter of JSON

c#,json,parsing
Sorry for the ambiguous title but I don't know how to explain better. Anyway, I made a code for parse a Json in c#, this structure: { "_links": { "self": { "href": "http://api.football-data.org/alpha/soccerseasons/354" }, "teams": { "href": "http://api.football-data.org/alpha/soccerseasons/teams" }, "fixtures": { "href": "http://api.football-data.org/alpha/soccerseasons/fixtures" }, "leagueTable": { "href": "http://api.football-data.org/alpha/soccerseasons/leagueTable" } },...

Nested JSON structure to build side-by-side d3.js charts

javascript,json,d3.js
I'm currently stuck on how to traverse a JSON structure (I created) in order to create side-by-side donut charts. I think I've created a bad structure, but would appreciate any advice. I'm working from Mike Bostock's example here: http://bl.ocks.org/mbostock/1305337 which uses a .csv file for source data. In that example...

Display only values containing specific word in array

php,arrays,json,string,if-statement
Right now I am working on a search function for my json decoded results. The code that I got looks like this: <?php foreach($soeg_decoded as $key => $val){ $value = $val["Value"]; $seotitle = $val["SEOTitle"]; $text = $val["Text"]; echo '<tr><td>' . $value . '</td><td>' . $seotitle . '</td><td>' . $text ....

Deserializing JSON into c# class

c#,json,couchdb
I have a JSON in the following format (from couchDB view) {"rows":[ {"key":["2015-04-01","524","http://www.sampleurl.com/"],"value":1}, {"key":["2015-04-01","524","http://www.sampleurl2.com/"],"value":2}, {"key":["2015-04-01","524","http://www.sampleurl3.com"],"value":1} ]} I need to create a "service" to get this data from couchDB and insert it on SQL Server (for generating reports..) in a efficient way. My first bet was to bulk insert this json...

How to group several JSON objects which contains array with same id together

jquery,arrays,json
Please help to figure out how can I group and display JSON objects. Here's my example: var result = [ { "data": [{ "id": 1, "name": "aaa" }] }, { "data": [{ "id": 2, "name": "bbb" }] }, { "data": [{ "id": 1, "name": "cccc" }] }, { "data": [{...

Search/autocomplete using JQuery from JSON file(need to get only result starting with the alphabet given)

javascript,jquery,html,json
I have created a country search when typing in the input box. HTML is Country<div class="holder_form"><input id="country" name="country" type="text" placeholder="Country" value=""> <ul id="country_wrapper"></ul> Javascript is var countries={ "1": { "name": "Afghanistan" }, "2": { "name": "India" }, "3": { "name": "Canada" }, "4": { "name": "Estonia" }, "5": { "name":...

Iterating over EncryptedDataBagItem in Chef Recipe

ruby,json,chef,devops
I would like to decrypt a chef data bag item (named passwords) and store all of its attributes in a temporary JSON file which is read (and then deleted) by a node.js app. Is there a way to iterate over attributes of a data bag ITEM and get their values?...

Codeigniter Select JSON, Insert JSON

json,codeigniter,select,insert,routing
I have very simple users database: user_id, user_name, user_email My model this: class Users extends CI_Model { private $table; private $table_fields; private $table_fields_join; function __construct() { parent::__construct(); $this->table = 'users'; $this->table_fields = array( $this->table.'.user_id', $this->table.'.user_name', $this->table.'.user_email' ); $this->table_fields_join = array(); } function select(){ $this->db->select(implode(', ', array_merge($this->table_fields, $this->table_fields_join)));...

How to work with django-rest-framework in the templates

json,django,django-templates,django-rest-framework
Please bear with me. I am just learning django-rest-framework. And I really can't seem to grab it. model: class Day(models.Model): date = models.DateField(default=date.today) class ToDo(models.Model): date = models.ForeignKey(Day) name = models.CharField(max_length=100) very_important = models.BooleanField(default=False) finished = models.BooleanField(default=False) normal view: def home(request): days = Day.objects.all() return render(request, 'test.html', { 'days':days })...

php array returns undefined but print_r shows otherwise [duplicate]

php,arrays,json,undefined
This question already has an answer here: PHP: “Notice: Undefined variable” and “Notice: Undefined index” 11 answers foreach($jsonmediationinfo as $value1) { echo $value1['mstatus']; print_r($jsonmediationinfo); } Output: 1Array ( [0] => Array ( [mstatus] => 1 [mhearingnum] => first [mminutes] => adakjaflafjlarjkelfkalfkd;la ) [1] => Array ( [mhearingnum] => second...

Flask - Getting JavaScript and Python to Communicate

javascript,python,json,flask
I'm building a rather simple CRM using the Flask Python framework. I have a database of companies that we are interested in contacting. The user first inputs how many companies they would like to contact. The user is then redirected to this page: Essentially for each row/company on this page,...

.NET wep api won't accept %2E or . in api request uri

c#,jquery,asp.net,ajax,json
We're trying to create our first web api using the .net framework. To try this we've used this demo project: http://www.codeproject.com/Articles/549152/Introduction-to-ASP-NET-Web-API In this project we've changed the find() function of the AJAX script so it only sends one var to our new democontroller.: <script> var uri = 'api/Demo'; function find()...

Getting front value from array/json

php,arrays,json
I want to get my image value wich could be images/thispicture.png for example. I have an Array or Json with some values, but the problem is i only want the image from array. This is what i get now from the array: {"image_intro":"images\/16748007940_1cc8f06622_small.jpg","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}"><img...

Need help converting JSON to C# Objects

c#,asp.net,json,object,serialization
I'm currently trying to convert a JSON string into C# objects and currently am experiencing trouble during my debugging. Below is a sample of the JSON along with my classes. Classes public class Timeline_RootObject { public List<Timeline_Frame> frames { get; set; } public int frameInterval { get; set; } }...

SwiftyJSON Reading JSON Array issue

json,swift,swifty-json
I'm trying to read a json array data as below with my code but I'm getting empty result all the time while I can print the whole data. Please where would be my issue? I've read this topic but I couldn't get the result. Topic Link {"Cars":[{"Brand":"Alfa Romeo"},{"Brand":"Audi"},{"Brand":"BMW"},{"Brand":"Citroen"},{"Brand":"Dacia"},{"Brand":"Fiat"},.......... My code...

laravel file uploading using json

jquery,ajax,json,laravel,laravel-5
I am using laravel 5. I have did the following code to post data using json to my controller. But I cannot make file uploading by this manner. e.preventDefault(); $.ajax({ type: 'POST', cache: false, dataType: 'JSON', url: 'tasks', data: $('#my_form').serialize(), success: function(data) { console.log(data); }, }); I have the following...

Deserializing Json data to c# for use in GridView - Error Data source is an invalid type

c#,json,gridview,serialization,.net-4.5
I am relatively new to working with C# (v5.0) and Json data (Newtonsoft.Json v6.0) and am seeking assistance in resolving an error when attempting to populate a .Net 4.5 GridView control. My sample Json data as returned by a web service is: { PersonDetails: [ { Book: "10 ", FirstName:...

Complicated Json processing - PHP

php,json
I am using this JSON: http://steamcommunity.com/id/mitch8910/inventory/json/730/2/ I am sorting through the "rgDescriptions" data with this: $data = file_get_contents('http://steamcommunity.com/id/mitch8910/inventory/json/730/2/'); $json = json_decode($data); foreach ($json->rgDescriptions as $mydata) { //checking and adding data to a database } Each section in "rgDescriptions" contains a lot of information on a certain item. For each item...

Android AsyncTask with JSON Parsing error

java,android,json,web-services,wcf
Error coming in this section: protected void onPostExecute(JSONObject json) { try { // Getting JSON Array user = json.getJSONArray(TAG_USER); JSONObject c = json.getJSONObject(0); String id = c.getString(TAG_ID); String name = c.getString(TAG_NAME); Log.i("id",id); } } ------- Webservice Result--- {"GetDataResult":{"ID":8,"Name":"Foo Bar"}} Working Link - http://127.0.0.1/WcfService4/Service1.svc/getData/?key=8 Provide the better solution for solving this....

how to deserialize a blank json string value to null for java.lang.String

java,json,jackson
I am trying a simple json to de-serialize in to java object. I am however, getting empty String values for java.lang.String property values. In rest of the properties, blank values are converting to null values(which is what I want). my Json and Java class are listed below: Json string: {...

Can't get JSON response with swift [closed]

php,mysql,json
I have such swift code where in the storyboard is E-mail,Username,Password text fields and Register button: http://pastebin.com/jBkbxDCh And the userRegister.php is stored at /Applications/MAMP/db/mysql/test , which code is: http://pastebin.com/n36DJTTg I have database named test and there is table named users with additional information. So when i start app and enter...

all the names are not fetching from arraylist

json,arraylist
Json file show on arraylist, I want to show all the names from the arraylist from the json file. try { JSONArray root = new JSONArray(json); for (int i = 0; i < root.length(); i++) { JSONObject att = (JSONObject) root.getJSONObject(i); name = att.getString("nm"); list.add(name); } for(int i = 0;...

Link to another resource in a REST API: by its ID, or by its URL?

json,api,rest,api-design,hateoas
I am creating some APIs using apiary, so the language used is JSON. Let's assume I need to represent this resource: { "id" : 9, "name" : "test", "customer_id" : 12, "user_id" : 1, "store_id" : 3, "notes" : "Lorem ipsum example long text" } Is it correct to refer...

Error parsing JSON data - “Uncaught SyntaxError: Unexpected token .”

javascript,jquery,json
I'm getting the error below in Chrome while parsing a JSON data. The data sample is at http://jsoneditoronline.org/?id=31ffc7c0e7e1a9a2adf641306497b57a This is a valid JSON and my server is sending the correct Content-Type value (application/json). Uncaught SyntaxError: Unexpected token . Firefox reports a slightly different message but it all points to the...

Get local json file using request-promise

javascript,json,angularjs,node.js,express
I'm making a node/express app and am querying a test json file using npm request-promise. Node is spitting out the following error in my <title> tags: Error: <title>Invalid URI "../testJSON/user.json"</title> I believe my pathing is correct, so am unsure why it's an invalid URI. I've also provided the entire project...

convert from json to array

javascript,php,json
I am trying to get data to display in a table. I don't know what I am doing wrong, but when I get the data from my page it is an array of single characters. I could parse this myself but would prefer to know what I am doing wrong....

Database Row with Multiple JSON values - How to get a specific value

php,json
So my question of the day would be, how can i get a specific value from a single database row which has multiple JSON values using Php. The data has been put in the Database as such: a:7:{s:5:"cname";s:4:"enes";s:6:"cemail";s:22:"[email protected]";s:8:"caddress";s:18:"Florisvosstraat 56";s:4:"ctel";s:12:"+31685035990";s:9:"ccomments";s:5:"fdfsf";s:15:"wppizza-gateway";s:3:"cod";s:12:"wppizza_hash";s:64:"34e24d48186596cae445d52c5b0650d20c8a7c215ef1fe323ca6f09b7f804a8d";} So ofcourse i already have the code to get this from...

How to use ajax response JSON data?

javascript,jquery,ajax,json
I have made my ajax request, which works great and returns JSON. But how do i use it? My response is something like this [{ "id": "5", "reviewID": "2389", "serviceID": "50707", "title": "well done" }] Now in my success function I am trying to use the data like such: success:...

nested ajax parent completed before child had finished

jquery,ajax,json,nested
$.ajax( { type: 'POST', url: [email protected]("EkranListeleSektor")', dataType: 'json', async: false, //added async later, no changes data: { sektorID: $("#ekranSektorID").val() }, success: function (items) { $.each(items, function (i, ekranlar) { $.ajax({ type: 'POST', url: [email protected]("IlAdGetir")', dataType: 'json', data: { id: ekranlar.il }, success: function (ilAd) { strIlAd = ilAd; }, error:...

Accessing Coordinates in Nested JSON File

javascript,jquery,json,google-maps
I'm trying to access lat/lng of polygons within a nested JSON file and trying to draw them using new google.maps.Polygon(), but having some troubles. UPDATE-2: I am able to draw polygons, but it only draws the first polygon, not all 3: http://jsfiddle.net/vprbqaLm/10/ UPDATE: Check out my latest JSFiddle here: http://jsfiddle.net/vprbqaLm/9/...

How to transform $.post to $.ajax?

javascript,jquery,ajax,json,servlets
I have this $.post peace of code: $.post("../admin-login", { dataName:JSON.stringify({ username:uname, password:pass, }) }, function(data,status){ console.log("Data:"+data); answer = data; } ); and I wont to transform it to $.ajax. On the servlet side I am demanding request.getParamter("dataName") but I do not know how to write data: section in $.ajax so...

'utf8' codec can't decode byte 0xf3

python,json,character-encoding
I am using python 2.7 to read the json file. my code is import json from json import JSONDecoder import os path=os.path.dirname(os.path.abspath(__file__))+'/json' print path for root, dirs, files in os.walk(os.path.dirname(path+'/json')): for f in files: if f.lower().endswith((".json")): fp=open(root + '/'+f) data = fp.read() print data.decode('utf-8') But I got the following error....

Call function on Server from iOS app - Objective C

ios,objective-c,json,server,backend
If you are familiar with Parse.com's Javascript SDK, this is what I am trying to do for my own server for my iOS app (Objective-c). I want to be able to send some a string to the function that is on my server, have the server run its function and...

Javascript JSON parsing not working as expected

javascript,json
I have this code to parse values from a JSON API. I'm trying to access the values in an array, but I'm getting TypeError: Cannot read property "results" from undefined. (line 24). My code is as follows: function getItemID(searchTerm) { var fetchUrl = "http://www.gw2spidy.com/api/v0.9/json/item-search/" + escape(searchTerm) + "?exclude_unsellable=1"; var jsonData...

How to unmarshall akka http request entity as string?

json,scala,akka-http
I'm trying to unmarshall request payload as string, but for some reason it's failing. My code: path("mypath") { post { decodeRequest { entity(as[String]) {jsonStr => //could not find implicit value for...FromRequestUnmarshaller[String] complete { val json: JsObject = Json.parse(jsonStr).as[JsObject] val jsObjectFuture: Future[JsObject] = MyDatabase.addListItem(json) jsObjectFuture.map(_.as[String]) } } } } } In...

Getting error in JSON parsing with array in iOS

ios,json,parsing,nsjsonserialization
I am newly to iPhone, basically in my application I am parsing below JSON model and need to save it in my custom Entity class. JSON model : { "Products": [ { "Pcs": [ { "product_id": 2, "product_name": "MyProduct", "category": { "Clamshells": [ { "product_category_id": 11, "product_category_name": "MyProductCategory", "Sub_category": [...