json

Load local JSON files via file:// triggers cross-domain null origin violation, solution? (jQuery)

Hi all, I have a webpage I'd like to use locally, without a web server, by simply opening the local HTML file in my browser. This webpage in question loads data via jQuery's getJson() method, as in: $.getJSON("mydata.json", function(j) { ... The JSON files are also local, and are stored in the same directory as the webpage. When I a...

Spring 2.5 and Json

any body ever try this tutorial ? I follow that tutorial, but I've got 404 error while I access hello.json. I'm new at code java application with spring, may be there some mistake with my configuration file. My project name is jsonapp web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-...

How to make a REST call in JSP?

Hi, everyone, I want to ask a question about the JSP and REST call. I am making a JSP page and need to mark a REST call and receive the REST call in JSON format. The JSP (.war) is running on the tomcat server. Like the following: JSP(REST call) -> server -> JSON format(REST respond) However, I don't know how to make the call and respo...

Confused about very basics of JSON - Some APIs make me download a file, others show the json

Tonight I want to make a request to the topsy.com API, which returns JSON and render that as HTML. I've never done anything with json before since it's impossible to read in the browser, but that's the only format Topsy returns, so I'm trying to learn what I can. I have a very basic question: Why do some APIs make me download a json ...

Zend_Json_Server and dojo.rpc.JsonService, can a served class return an object?

I am trying to serve up my user repository via zend_json_server. The problem is the service is returning empty objects. What have i missed? server side: $repo = App_User_Repository::getInstance(); $server = new Zend_Json_Server(); $server->setClass($repo); if ('GET' == $_SERVER['REQUEST_METHOD']) { $server->setTarget('/ser...

Help using json_encode to produce specific format

Hello, i want to use php's json_encode function to take data and produce the following format, but am struggling with it. Can anyone advise if this can be done via json_encode()? Thanks for any help! data: [{ x: 3, y: 0 }, { x: 10, y: 0 }] ...

Posting JSON with JQuery

Trying to get JQuery to post JSON to a server: $.ajax({ url: "/path/to/url", type: "POST", dataType: "json", contentType: "json", data: {"foo": "bar"}, success: function(){ alert("success :-)"); }, error: function(){ alert("fail :-("); } }); Problem is the data appears on...

Writing out JSON data to a simple textfile

Hi! As always I have searched the forums and googled my self slightly insane without being able to figure out what I am doing wrong. Therefore I turn to the great minds frequenting this site in hopes to find an answer. I'm building an application that will communicate with a database and in doing so I'm trying to learn how to use JSON t...

Parsing array of JSON arrays in Groovy

I have the following string from a REST JSON response: [{"uid":10512213, "name":"Bob"},{"uid":7208201, "name":"John"},{"uid":10570, "name":"Jim"},{"uid":1799657, "name":"Sally"}] The rest response definition is from Facebook: FB REST Link I am using Google App Engine + GAELYK which runs in Jetty. What is the best way to convert the a...

Hashing JSON in PHP does not produce the same result as in Javascript for unicode characters

Hey! My web application communicates with the server over JSON protocol. Before sending each JSON message from the web application, I run a hmac-sha1 function on it (on already encoded object) and insert the resulting HMAC into the header of JSON request. On server side, I decode JSON message with PHP, extract the HMAC, unset() the HMA...

JQuery: Merge multiple JSON results

Situation: User want to import Youtube playlist in a JQuery site using Youtube's JSON API. Problem: Youtube only gives back first 50 entries, but playlists can be 100+ entries long (length is given by 'totalItems' in JSON response). All the entries need to be merged as 1 object and need to be pushed into an output function at the end. ...

Does Silverlight cache web service calls?

Here's the problemo: My Silverlight application is calling a HTTP web service, using WebClient, called getCampaigns which returns a JSON array of data for Campaign objects. The user can then interact with the requested objects, modifying them, removing them, etc. When the user removes a campaign, Silverlight calls another web service, w...

Architecture of a Java EE web application

Hello! I want to realize the following scenario: The frontend is based on HTML5 / CSS3 / JavaScript (with a JavaScript framework like ExtJS or jQuery). I have full HTML pages with forms, buttons, text fields, which have submit buttons which should send the data to the webserver. On the other hand I also have a website in this web applic...

jQuery (cross domain) .getJSON, store response in re-usable variable

I want to get the IP from the current user and send it along with an AJAX POST to a PHP file. Which means I need to re-use the variable I get in the response from the IP .getJSON request. Script 1: I found this handy snippet on snipt: $.getJSON("http://jsonip.appspot.com?callback=?",function(data){ alert( "Your ip: " + data.ip); })...

jqGrid colModel and jsonReader with no cell

The following json and jqgrid options give me no data in my grid. var grid = jQuery("#grid")[0]; grid.addJSONData({ // the json total: 1, page: 1, records: 10, items: [ { ProductID: '1', Name: 'Coke' }, { ProductID: '2', Name: 'Pepsi' }, { ProductID: '3', Name: 'L // jqGrid options { ... ...

Is it good and safe to use Json object to submit form data? I am using MVC 2 with JQuery Post

In my ASP.Net MVC 2 application I am using a Json object to submit form data. I would like to take expert advice whether it is a safe and good practice to do it or not and why? Please note, this question is not about how to do it but rather about best practice. Appreciate your valuable suggestions. ...

Unix command-line JSON parser?

Can anyone recommend a Unix (choose your flavor) JSON parser that could be used to introspect values from a JSON response in a pipeline? ...

How to read json response as name value pairs in JQuery

I want to read json response as name and value pairs in my JQuery code. Here is my sample JSON response that I return from my java code: String jsonResponse = "{"name1":"value1", "name2:value2"}; in my JQuery, if I write jsonResponse.name1, I will get value as "value1". Here is my JQuery code $.ajax({ type: 'POST', dataType:'...

Automatic web-page refresh memory leak using XMLHttpRequest

Greetings, I've been working on a web-interface for some hardware that uses an 8-bit microcontroller. The web page uses HTML, javascript, JSON and XHR (XMLHttpRequest) for its communications. What I'm trying to do is create a page that updates every 250mS with new values from the controller using setInterval so that the web page gets u...

sort JSON by date

Hi, I know this must be relatively simple, but I have a dataset of JSON that I would like to sort by date. So far, I've run into problems at every turn. Right now I have the date stored as this.lastUpdated. I have access to jquery if that helps, but I realize the .sort() is native JS. Thanks in advance. ...