json

Middleware for MongoDB or CouchDB with jQuery Ajax/JSON frontend

I've been using the following web development stack for a few years: java/spring/hibernate/mysql/jetty/wicket/jquery For certain requirements, I'm considering switching to a NoSQL datastore with an AJAX frontend. I would probably build the frontend with jQuery and communicate with the web application middleware using JSON. I'm leanin...

Does jQuery support reading JSON from X-JSON HTTP headers?

Is jQuery able to read JSON data from X-JSON HTTP headers returned by the server? I've been searching through the jQuery docs, but all the examples I can find use JSON returned in the request body rather than the headers. ...

JSON_ENCODE in PHP Returns Chinese Characters as Hex

I've got a simple PHP one-dimension array. When I do a var dump (echo var_dump($a)), I get this as the output: array(3) { [0]=> string(3) "尽" [1]=> string(21) "exhausted||to exhaust" [2]=> string(4) "jin3" } However, when I JSON_ENCODE it (echo json_encode($a)) I get this: ["\u5c3d","exhausted||to exhaust","jin3"] The hex value tha...

Make output an object array

<?php //example code $url = 'http://clients1.google.com/complete/search?hl=en&amp;q=speed'; function processURL( $url ) { $contents = file_get_contents( $url ); return $contents; } print_r( processURL($url) ); ?> Output: window.google.ac.h(["speed",[["speed test","89,300,000 results","0"],["speed channel","76,100,000 results"...

Browser response size limit.

Hi all, I am calling my cross domain web-service through a getJson() call from jQuery. As my response object size is pretty big, i have used the maximum JSon size for my web-service. I have checked getJson() is giving proper response object. But still my callback function is not called. Firebug is saying that it's(firefox) response siz...

Passing Lists as a QueryString - should I use JSON

Lets say I've got an online dating site, users can filter the user list based on various criteria, Height, Age, BodyType, Ethnic Origin.... I want to pass the criteria to the pager, via QueryString. Height and Age are easy as these are ranges, and I would use MinHeight=3&MaxHeight=12&MinAge=21&MaxAge=30 However other Criteria like...

YUI "Get" utility to parse JSON response?

The documentation page for the YUI "Get" utility says: Get Utility is ideal for loading your own scripts or CSS progressively (lazy-loading) or for retrieving cross-domain JSON data from sources in which you have total trust. ...but doesn't have any actual examples for how to do so. Their one example doesn't actually reque...

Trying to parse twitter trends

Im trying to parse twitter trends but i keep getting a parser error at "as_of". anyone know why this is happening? EDIT: Here is the code im using NSMutableArray *tweets; tweets = [[NSMutableArray alloc] init]; NSURL *url = [NSURL URLWithString:@"http://search.twitter.com/trends/current.json"]; trendsArray = [[NSMutableArray alloc] i...

html string not being parsed with JSON.parse

I am using JSON.parse for a list of products. I am running a regex to replace characters that were breaking the parse: [\n|\t|\r] It seems that I am still having issues when the following content is being copied into html. <p><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: arial, Verdana, Helvetica; -webkit-bo...

What's the most JSON you can reasonably expect to decode on the client side

This morning I tried to use ExtJS' JSON decoding facilities against 0.75MB of data, and it crashed FF3. I'm wondering what is the most JSON one can reasonably expect to decode on the client side? This could be using ExtJS, jQuery, other Javascript frameworks or any built-in decoding that Javascript itself may offer. ...

JSON encoding problem in IE6 and IE7

Can someone tell me how to change this getJSON request to a .ajax call so I can set the contentType option? $.getJSON('json/showreel.json', function(data) { //get total number of JSON objects and generate random numder var total = data.length; var randnum = Math.floor(Math.random()*total) //Loop through each of the JSON...

javascript undefined error, but alert toSource shows the object exists

I grabbed a bit of code to do some paging with jQuery, via Luca Matteis here http://stackoverflow.com/questions/516754/paging-through-records-using-jquery I've made some edits to the paging script so that I can use the same code to provide paging of different content in different locations on the same site. For the most part, I think ...

A tidy solution for using static JSON data

I'm developing a simple JavaScript (jQuery) slide show. I wanted to use JSON to store some some static parameters about the content of each slide. Since I like to keep my data separate from my code, is there anyway to have JavaScript evaluate a .json file? AJAX seems a bit overkill - it just needs to evaluate it at run-time, nothing ...

Anything similar to E4X to find in/traverse JSON?

When for example returning JSON from a Google Spreadsheet, the object returned contains an array of entry objects (corresponding to rows in the spreadsheet). An entry can have a name like so: jsonObject.feed.entries[15].name = "xyz"; Can I easily return an entry with the name of "xyz" using shorhand notation (E4X) of some sort? thanks...

Web services API design: XML elements vs. attributes

I'm designing an API for a web service and I can't decide between using XML attributes, elements or a mixed architecture. Let me show you an example. Let's assume I have an object called Domain. This model has 3 properties (tld, sld, trd and the name itself) and a method valid? that returns true if the domain is valid. # I'm using ruby...

JSON.Net serialization and custom objects

So I was working toward a fairly lightweight approach at serializing some of my objects, and was hoping to use NewtonSoft's JSON.Net. The challenge is that I'm trying to use a simple interface for serializing an IDictionary. T in this case will be one of several entities in my domain that all have a Guid id (which becomes its key in th...

Quickest way to convert XML to JSON in Java

What are some good tools for quickly and easily converting XML to JSON in Java? Thanks in advance for all your help! ...

Instruct WCF Service to return JSon.

Hi, I want to know if by default the WCF web services return JSon data. and if no how can i configure the most simple WCF web service it to return Json. thanks in advance. ...

Best JSON parser for Qt?

I'm using QT for Symbian and need a simple json parser. I need to be able to go from json to Qt-variant and the other way around. Is there a simple json parser that I can use? I don't want to write my own. What is the best way to go? Thanks! ...

Passing a list to eval()

Is there a way to pass a list as a function argument to eval() Or do I have to convert it to a string and then parse it as a list in the function? My simple example looks like: eval("func1(\'" + fArgs + "\')") I'm just not sure if there is a better way of taking fArgs as a list instead of a string Note: The list is provided from a ...