json

How to get current UTC time in JSON format using Javascript?

Hello, I have a JSON Date for example: "\/Date(1258529233000)\/" I got below code to convert this JSON date to UTC Date in String Format. var s = "\\/Date(1258529233000)\\/"; s = s.slice(7, 20); var n = parseInt(s); var d = new Date(n); alert(d.toString()); Now I need to get current UTC Date with Time and convert it into JSON da...

problem with json and eval

I can't seem to find any solution to this within SO so here goes. I have a call to a WebMethod within the C# of my page like this; $.ajax({ type: "POST", url: "MyWebPage.aspx/jQueryMyWebMethod", data: "{FamilyType:'" + $('.HdnFamilyType').val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json"...

jQuery: Possible to wait for $.get to finish loading before continuing?

The folowing script does not wait for $.get to finish loading the page before continuing with the loop: $.each(data.songs, function(index, val) { $('#nowartist') .append('song starting'); $.get("http://localhost/play.php", function(data){ alert('done'); }); }); data is a JSON object Any ideas or comments...

Techniques to reduce data harvesting from AJAX/JSON services.

I was wondering if anyone had come across any techniques to reduce the chances of data exposed through JSON type services on the server (intended to supply AJAX functions) from being harvested by external agents. It seems to me that the problem is not so difficult if you had say a Flash client consuming the data. Then you could send en...

.NET Webservice doesn't return JSON data anymore

Hello, Last months I've been busy creating a .NET Webservice with several functions and a website written in html and Javascript which acts as the user interface and calls the webservice methods with JSON. The webservice returned JSON responses and it did work very well. Then I concentrated on the webservice to finish all the functional...

Consuming JSON object in PHP, sent from jQuery

Hi all, I'm sending a JSON object to PHP using jQuery via $.ajax({ url: myURL, type: 'POST', contentType: "application/json; charset=utf-8", data: myData, processData: false, dataType: 'html', async: false, success: function(html) { window.console.log(html); } }); and trying to decode t...

Nested JSON in IE6 causes problems.

I'm making a request to a JSON page using jQuery's $.getJSON method, and from the returned JSON i'm creating some HTML and putting it on to the page. The problems appears when I have a nested JSON object, i'll show you an example later. First off, if I make a request to my JSON page and return the following JSON, the function works ju...

Get object within JSON object only by knowing its position, and not name

Hi, I'm currently looking into the Twitter-API - specifically the daily trends-API (http://search.twitter.com/trends/current.json). Example return from Twitter { trends: { 2009-11-19 14:29:16: [ { name: "#nottosayonfirstdate", query: "#nottosayonfirstdate"...

Javascript: Write Console.debug() output to browser?

I need to be able to take any JSON data and print the key/value pairs. (something similar to print_r() in PHP) Is this even possible with javascript? ...

Merging JSON files using text pad

I am looking to merge two json messages. What I found is that it is a lot more difficult than I thought.. it needs to be parsed and serialized. The new JSON looks nothing like either input JSON file... Why can't just cut and paste to generate a new JSON file? Do I have to do it programmatically? ...

How should one provide links in RESTful service using a non-XML data representation?

Hi all I've been doing a lot of reading lately about how to implement truly RESTful WS's. A lot of people have linked to the article here which details several constraints that implementers should bare in mind if the want to end up with services that conform to the REST concept. Whilst the post is clearly important, it is unfortunat...

How to get live stock data from the SIX Swiss Exchange?

Hi Do anybody have any experience with retrieving live stock data for a specific stock from SIX Swiss Exchange? Preferably as JSON data since I am going to display it on a website. There are quite a few charting tools out there, so displaying the data is not the main issue. The data do not need to come from SIX directly, any source is...

Using only JQuery to update Twitter (OAuth)

Hi, we would like to send a JSON update command to twitter, but only using JQuery, not having to go to the webserver and have it done in PHP. The thing I can't grasp really is how to send the user credentials in the JQuery/JSON twitter API call. Our user credentials are from Twitter's OAuth. thanks, cheers! ...

Error at json: "missing ] after element list" or just "undefined"

Hello! I have a json like: {"156644":{ "name":"name1", "street":"street1", "city":"city1" "68656":{ "name":"name2 ", "street":"street2", "city":"city1" "388655":{ "name":"name3", "street":"street3", "city":"city1" "4564":{ "name":"name4", "street":"street...

Learning JSON in relation to php

Anyone knows where i can get good introduction info on json in relation to php ...

Jquery.AjaxComplete and not executing specific code if I want

For example I have general code for catching json, that says - "its error request". This code is in ajaxComplete, how can I stop executing specific code from ajaxComplete point? $.post('url', params, function(json){ if (json.success == false){ alert('error') } if (json.success == true){ ...

XML <-> JSON conversion in Javascript

Hi, Does anyone know of a good solution to convert from XML to JSON and then back to XML? I found two tools for jquery, xml2json & json2xml. Each of these works very well - however, the conversions they use aren't 100% consistent. Has anyone encountered this situation before? ...

Mimetypes for a RESTful API

The Sun Cloud API at http://kenai.com/projects/suncloudapis/pages/Home is a good example to follow for a RESTful API. True to RESTful principles, when you GET a resource you get no more nor less than a representation of that resource. The Content-Type header in the response tells you exactly what the type of that resource is, for examp...

HTML template + JSON vs Server HTML

What do you think is better? Use for Ajax result: HTML that was generated on server Return Data that would be used within template? I think plus for server rendering are escaping, easy more complex logic, when much data needed! ...

Using g.render in a grails service

I'm trying to use g.render in a grails service, but it appears that g is not provided to services by default. Is there a way to get the templating engine to render a view in the service? I may be going about this the wrong way. What I'm looking to to is render the view from a partial template to a string, and send the resulting string...