json

Parsing JSON data including date creates wrong Date object.

I make an ajax call with jQuery 1.4.2 with dataType: 'json'. $.ajax({ url: url_with_json_formated_response, data: jsonOptions, dataType: 'json', error: function(XMLHttpRequest, textStatus, errorThrown){ alert('unable to get data, error:' + textStatus); }, ...

JQuery + Json - first steps with an example

Hi. I need (recently) to get an array from the server after an ajax call created by jquery. I know that i can do it using JSON. But i don't know how to implement it with JQuery (im new with JSON). I try to search in internet some example, but i didnt find it. This is the code : // js-jquery function function changeSponsor() { $.aja...

More elegant way to deserialize Json with LINQ?

I have data of the following form: { "sections" : [ { "section" : { "Term" : "News", "Term ID" : "4,253" } }, { "section" : { "Term" : "Sports", "Term ID" : "4,254" } }, // ... ] } I would like to serialize it into a collection of the following class: publ...

WCF Service, JSON Input Datatype, Error in deserializing body of request message for operation

Hi I have a WCF Service method SavePlannerData that has one of input Guid datatype. Now if there is no Guid, it is coming as EmptyString ("") instead of null. If it is null, it is working fine. If it is emptystring, it is not calling WCfService and It is throwing the following error: Error in deserializing body of request message for...

using Python to generate a C string literal of JSON

I have a dictionary in Python that I would like to serialize in JSON and convert to a proper C string so that it contains a valid JSON string that corresponds to my input dictionary. I'm using the result to autogenerate a line in a C source file. Got it? Here's an example: >>> import json >>> mydict = {'a':1, 'b': 'a string with "quotes...

How to bind object as a json string to another html element on JQUERY Template plugin

Actually i tried to find it but i was lost in plug-in lines while debugging. I want to show how it is working because there are different template plug-ins. $("#teplateScript").tmpl(arrOfWhatWeWantToBind).appendTo("#divElementwhichWillContainTheOutput"); I want to serialize every element of array(to json of course) with JSON.stringify...

AJAX response: sugestions for JSON format?

Say I submit a form via Ajax and need a response from the server: Pass/fail indicator On fail, a list of validation errors with associated field ids/names, etc Is there a standard or best practice for the JSON format for such a structure? If so, I'd like to try to stick to it instead of coming up with my own convention. ...

Storing JSON in MySQL?

I have some things that do not need to be indexed or searched (game configurations) so i wa sthinking of storing json on a blob. is this a good idea at all? or are there alternatives? ...

android to django - how to authenticate users

Hi all I'm trying to get json data from a django view (login required) into a new android app I'm working on. I would like to authenticate the user against the django login and keep the cookie/session for all the django view calls to get data from the server. I did some googling but nothing helped me, even if I guess it should be a q...

JSON: Standard way of referencing an object by identity (for, eg, circular references)?

Is there a standard way of referencing objects by identity in JSON? For example, so that graphs and other data structures with lots of (possibly circular) references can be sanely serialized/loaded? Edit: I know that it's easy to do one-off solutions (“make a list of all the nodes in the graph, then …”). I'm wondering if there is a stan...

Livesearch function with JSON

Hi all, I currently have a method whereby there is an <input type="text" id="politician" name="politician" onkeyup="showResult(this.value)" value="Enter a politician's name"/> tag. In that same file that includes the input tag, there is a link to an external javascript file called ajax.js The contents of that file are as follows:...

Access JSON value dynamically

Hi there, This is probably unbelievably basic. In the code below, I have annotated the part that needs attention. I just do not know how to structure it if, instead of res.DATA.VALUE[i], I make it dynamic and write 'res.DATA.' + textCol + '[i]' (pure pseudocode, I realise it won't work) function loadSelect(entity,textCol,retField,m...

Does C# have a library for parsing multi-level cascading JSON?

Is there a library (C# preferred) to resolve what I would call multi-level cascading JSON? Here is an example of what I mean: (Pseudocode/C#) var json1 = @"{ ""firstName"": ""John"", ""lastName"": ""Smith"" }"; var json2 = @"{ ""firstName"": ""Albert"" }"; var json3 = @"{ ""phone"": ""12345"" }"; var casc...

Preselecting multiple options

Hi there, I can't find a solution that works for me. I'm trying to preselect multiple values in a multiple select box depending on what JSON returns. JSON returns the following string from a coldfusion cfc: "4^Caribbean,8^Middle East,5^North America" The string is represented by "res" in the code below: $.each(res.split(','), fu...

Jquery autocomplete: Which is faster? (A) php/mysql/jquery or (B) html/json/jquery? I have two scripts, which is better/faster?

I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and the other makes use of (B) html/jquery/json. I know that since they're using different technologies they might not be able to be compared directly, but from your own experience and from what you can gather from the pages these scripts are located on,...

javascript IP address question, what if fail to load/no internet connectivity

Hi, I have some code that if I'm at home; it will display at popup saying that if you are at home. If you are not at home it will display a popup saying you are not at home. As the script is located on a server to give an IP address, how can I get it to say if you are not connected to the internet, as it will fail to load so I would have...

How to change JSON object before send ExtJS

I everyone i have a JSON Array that is construct like this for (var i = 0; i < count; i++) { var record = myDataStore.getAt(i); if (record.dirty){ submitRecords[currentIndex] = record.data; //alert(submitRecords[curre...

jQuery best way to get JSON with ajax

I am developing an eshop and the client wants ajax. I think that this is a bad idea because its going be slow. However while viewing the products there are some filters on the left. When a user selects a filter some other should be disabled. For example there may be jackets for both males and female, but the red colour is only availabl...

Getting keys from JSON

I've read through a couple of dozen of these questions, but I can't find this solution. I want to output the key of a JSON key:value pair. Assuming the JSON is like this: {"group":[ {"ed":"BDeveloper","st":"New","type":"B"}, {"ed":"BDeveloper","st":"Cancelled","type":"B"} ]} I want to scrape the "ed", the "st", etc. out of the pair u...

Custom marshaling TDictionary in Delphi

Hello, I need to custom marshal/unmarchal a TDictionary in Delphi (XE). The dictionary is declared as: TMyRecord = record key11: integer; key12: string; ... end; TMyDict: TDictionary<string, TMyRecord>; Now, if i marshal the dictionary without registering a custom converter, the marshaller will put all kind of fields in the JSO...