A double quote even if escaped is throwing parse error.
look at the code below
//parse the json in javascript
var testJson = '{"result": ["lunch", "\"Show\""] }';
var tags = JSON.parse(testJson);
alert (tags.result[1]);
This is throwing parse error because of the double quotes (which are already escaped).
Even eval() won't work ...
I have a JSON object with a key element called callback.
{
"id":34,
"description":"",
"item_id":4,
"callback":"addNew",
"filename":"0000072.doc",
"type":"News",
"ext":"doc",
"size":46592
}
I would like to call the javascript "addNew" function. I tried.
json.callback(json);
But does not work. Any idea?
...
I am receiving the next JSON response
{
"timetables":[
{"id":87,"content":"B","language":"English","code":"en"},
{"id":87,"content":"a","language":"Castellano","code":"es"}],
"id":6,
"address":"C/Maestro José"
}
I would like to achieve the next pseud...
I ‘m trying to make an Ajax call to an aspx page
On the server side request comes as "object object" and I cannot serialize it getting “not a JSON primitive.. ” it works however when instead of json object I pass json string .... Problem is that on a client side I’m using a json object that I have to convert to string before sending. I ...
Is it possible to exclude specified fields at runtime when serializing an object to a JSON string? i.e. When serializing an object, only serialize fields specified in list.
...
Hope someone can help!
I am calling a WCF service using JSON but I am not able to get the user credentials out.
We are using Kerberos so IIS is setup as the following:
Server-side tasks:
IIS server is member of domain
Set IIS server computer account in AD Users & Computers MMC as "Trusted for Delegation"
IIS Server must be rebooted f...
I need to make a synchronous request to the last.fm API, but when I use GET and json together, the request becomes asynchronous.
my code:
$.ajax({
async: false,
dataType: "json",
url: "http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist="+artist+"&api_key="+apiKey+"&format=json&callback=?",
succ...
I'm looking for a python equivalent of ruby's halcyon - a framework focused on "web service"-type applications rather than html-page-oriented ones. Google brings up a lot of example code and experiments, but I couldn't find anything that people were using in production and hammering on.
Failing that, what is the best web framework to us...
I'm using Python (Python 2.5.2 on Ubuntu 8.10) to parse JSON from (ASCII encoded) text files. When loading these files with json (simplejson), all my string values are cast to Unicode objects instead of string objects.
The problem is, I have to use the data with some libraries that only accept string objects.
Is it possible to get stri...
I need to pass a few serialized form elements into a function to return them as a JSON object. I wrote the function, but fieldName ends up in the json object as "fieldName" instead of the actual field name ie; "PositionId", or "Series". The values however are correct. JS will not allow me to use field.name, but it does allow field.valu...
I am working on an application using the YUI DataTable and my result set is rather large (2,000+ rows) which takes YAHOO.lang.JSON.parse() about 5-6 seconds to parse.
During this time the browser becomes completely unusable.
Does anyone know of a way to grab a JSON response and parse it into JS with timeouts? Say... 100 rows every 50-...
I'm trying to take an existing JSON object and create smaller JSON chunks out of it specific for creating separate graphs. Here is my code which uses jQuery:
function updateStationGraphs (bsid) {
$.getJSON("includes/system/ajaxDataInterface.php", {format:'flot',target:bsid}, function(data) {
var graphOptions = {
series: {...
What naming convention is recommended when writing an MVC app that has both front-end and JSON paths to the required data?
For example, let's say the user of your site has "Things". They should be able to go to a page to view their things, but we also need a way to pull those things back as JSON on other pages. I've been able to think...
I want to make X number of ajax requests in jQuery and add the json response to an array.
When all the ajax requests are done, I would like to execute some code. Is there a good way to solve this?
...
i think the title is self-explanatory, i work with easyPHP 1.7, which has the php version 4.3.3, which by itself doesn't include support for json, so i found php-json on the web but don't know how to set it up. so can someone help. thanks.
...
My form in the html DOM is a checkbox to click (there can be more than one). The problem occurs in the description string when ever I use an apostrophe, since my list object is single-quote deliniated. This is one of the checkboxes in the form:
<input type="checkbox" id="cbx" name="cbx" value="{'getPic': 'url', 'picsrc': 'http://lh3.g...
I understand its not a desirable circumstance, however if I NEEDED to have some kind of HTML within JSON tags, e.g.:
{
"node":
{
"list":"<ul><li class="lists">Hello World</li><ul>"
}
}
is this possible to do in Python without requiring to to be escaped beforehand?
It will be a string initially so I was thinking a...
Is there a generic approach to "compressing" nested objects to a single level:
var myObj = {
a: "hello",
b: {
c: "world"
}
}
compress(myObj) == {
a: "hello",
b_c: "world"
}
I guess there would be some recursion involved, but I figured I don't need to reinvent the wheel here... !?
...
If I get the following json from a RESTful client, how do I elegantly unmarshal the java.util.Date? (Is it possible without providing (aka. hard-coding) the format, that's what I mean by elegantly...)
{
"class": "url",
"link": "http://www.empa.ch",
"rating": 5,
"lastcrawl" : "2009-06-04 16:53:26.706 CEST",
"checksum" : "837261...
I've learned (the hard way) that I need to add parentheses around JSON data, like this:
stuff = eval('(' + data_from_the_wire + ')');
// where data_from_the_wire was, for example {"text": "hello"}
(In Firefox 3, at least).
What's the reason behind this? I hate writing code without understanding what´s behind the hood.
...