Tag: json

json default charset API and browser display

My api returns following json. HTTP/1.1 200 OK Date: Fri, 30 Aug 2013 14:14:32 GMT Server: Apache/2.2.22 (Ubuntu) Content-Length: 431 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: application/json { “member”: [ { “city”: “Li\u00e8ge”, “country”: “Belgi\u00eb”, } ] } following the specs ( JSON specs ) JSON text SHALL be encoded in Unicode. The default encoding […]

Formatting a JavaScript date into a string for JSON DeSeriailization

I am using the .NET NewtonSoft JSON serialization library and it is expecting date fields in this format: “UpdateTimestamp”:”\/Date(1280408171537+0100)\/” Does anyone know how I can format javascript date object into this format?

How to display a specific value from the array in Jquery / getJSON?

Basically I am getting a JSON feed using jquery using: $.getJSON(“http://localhost/1.php?method=getAllUsers&jsoncallback=?”) I get the values successfully from the feed stored in an array called data eg.: x => 1 y => 3 z => 5 (obviously this is in the json format) after this script i have the html, and a table <table><tr><td>y</td><td>value of y […]

Dynamic script tag security

I am analyzing whether using dynamic script tags to do requests to some third party servers is a good idea. Stackoverflow and a few other site had a couple of topics about these and I’m still left unsure that it’s a good idea. App is on server B. Third party API is on server A. […]

Google spreadsheet with hyperlinks via JSON

I’m using json-in-script to put content from a Google Spreadsheet on a web page. The spreadsheet has hyperlinks on some of the text in the cells. JSON doesn’t seem to be getting anything other than the plain text of the spreadsheet, and no markup like hyperlinks. How do you get hyperlinks? Can you with JSON? […]

How to convert a literal object into user defined object in javascript?

Writing a ton of web applications leveraging JSON/AJAX, I find myself returning tons literal javascript objects (JSON). For example, I may be request all the Cats from GetCats.asp. It would return: [ { ‘id’: 0, ‘name’: ‘Persian’ }, { ‘id’: 1, ‘name’: ‘Calico’ }, { ‘id’: 2, ‘name’: ‘Tabby’ } ] Now, these are all […]

Is it safe to serve jsonp if I require authentication headers?

I want to serve jsonp so other sites can get json data from my site. I understand that this would be dangerous if I used cookies to authenticate users, because browsers would send the cookies with all requests to my site, so a malicious page could make authenticated requests on my users’ behalves without asking […]

Problem accessing JSON object

I am querying the LinkedIn JS API to return a list of people. This list is returned as a JSON object. Here is the call back function: .result(function (result) { profile = result.values[0]; // Do something with the first linkedin profile in the list… }); The object ‘result’ returns something like the following: {“values”:[{“id”:”123456″,”firstName”:”Person”,”lastName”:”One”}, {“id”:”123456″,”firstName”:”Person”,”lastName”:”Two”}, […]

How to extract JSON from URL?

I’m looking to extract JSON data from a server URL that looks something like this: https://dev.randomdomain.com/subdomain The URL itself outputs the data like such: [ { “name”: “Not configured”, “mac_address”: “####c##c####”, “online”: “false”, “rate”: “Not configured”}, { “name”: “Not configured”, “mac_address”: “####c##c####”, “online”: “false”, “rate”: “Not configured”}, ] The outputed data changes and will need […]

Google charts: Slow in IE 8 and 9, but fine in Mozilla

Can anyone spot what might be slowing IE down to a crawl in the following JS / JQUERY / JSON. It isn’t slow until a large JSON dataset is added to it, but Mozilla based broswers are fine in like for like conditions. There are no script runtime errors. I have eliminated bad HTML as […]