json

Using single 'smart quote' in my JSON data is breaking PHP script

Hi folks, I've got a PHP script that is reading in some JSON data provided by a client. The JSON data provided had a single 'smart quote' in it. Example: { "title" : "Lorem Ipsum’s Dolar" } In my script I'm using a small function to get the json data: public function getJson($url) { $filePath = $url; $fh = fopen...

Creating a single JSON Parser/Network object

Hello, What I'm looking for is a point in the right direction of helping me create a better concept of what I need to do within my application design. What I'm trying to do is have a class that will make network requests, IE: getUser, getTimeline, getLocation. Once the data has been recieived via -(void)connectionDidFinishLoading: have...

is there anything wrong with returning this json result with two lists

I have an asp.net mvc site and i want to call the server when i change a dropdown list. my code hits the server controller action but i never get the callback. Is there any gotcha that i am missing here? Here is my controller action: public ActionResult LoadTeamsandApplications(int id) { WorkstreamRoadmapViewModel vm ...

$.getJSON not parsing object in callback

I have a simple getJson request: $.getJSON('JsonTest', function(o) { alert(o.Test); }); It works, but in Firebug the "o" never gets turned into an object, but stays a string: {"Test":"Hello"} If I do an eval('(' + o + ')') It gets evaluated fine, the only thing I can think of is that there's some sort of cross site scripting pr...

Method to save networkx graph to json graph?

Seems like there should be a method in networkx to export the json graph format, but I don't see it. I imagine this should be easy to do with nx.to_dict_of_dicts(), but would require a bit of manipulation. Anyone know of a simple and elegant solution? ...

How do I access variables in this JSON return using jQuery

Hi, How do I access the returned JSON Data? e.g the name array? to work JSON... {"COLUMNS":["NAME"],"DATA":[["Item 1"],["Item 2"]]} The data.NAME[1] doesn't seem to have any data in it.. $.getJSON('url/json.php', function(data){ $('#debug').html('data:' + data.NAME[1]); }); }); ...

jgGrid not displaying json data

This is driving me crazy, so any help would be awesome: My html is as follow: <asp:Content ID="Content3" ContentPlaceHolderID="Content" runat="server" class="MainLoginScreen"> <table id="StudyTable"></table> <div id="StudiesPager"></div> </asp:Content> My javascript is as follows: <script language="javascript" type="te...

POSTing a DateTime from Android to a WCF RESTful JSON Service

Hi, after hours of research I still haven't found any answer. I'm trying to send a DateTime as a Parameter to a Method exposed over a WCF RESTful Service with JSON encoding. The request looks like this: POST http://IP:PORT/LogService/json/GetLogEntriesByModule HTTP/1.1 Content-Length: 100 Content-Type: application/json Host: IP:PORT Co...

How to: Send JSON structure to server and return file in ASP.NET

I'm having a very hard time wrapping my head around this problem (it might be the heat from the summer finally arriving). Problem: I want the user to press a button client side which performs javascript data preparing and at last send a JSON structure to (currently a asmx webservice on) the server. The JSON structure is several levels d...

Spring 2.5.x MVC portlet with annotation & AJAX with jQuery+JSON Error: Content Type cant be set to json...

Hi all, When i try to use spring 2.5.x DispatcherPortlet with liferay to use Ajax, i am getting this error. I have configured it using annotations. At class level i used following annotations, Code for controller... @Controller @RequestMapping("VIEW") public class MyController { @SuppressWarnings("unchecked") @RequestMapping(method...

How to parsing JSON object in iPhone SDK (XCode) using JSON-Framework

Hello All, I have JSON object like this : { "data": {"array": ["2", {"array": [ {"clientId":"1","clientName":"Andy","job":"developer"}, {"clientId":"2","clientName":"Peter","job":"carpenter"} ] } ] }, "message":"MSG0001:Success", "status":"OK" } I want to get t...

sbrautaset's JSON-framework Objective-C: Getting null for objectWithString

I have some python code for Google App Engine that responds with the string {"sample_list": [{"message": "Hello, world.", "name": "Human"}]} I am using this JSON-framework developed by sbrautaset to convert the string to an object that I can use (NSDictionary in this case). I am following the tutorial here to use the framework. My prob...

Typecasting to get Value from json object

I'm having a bit of trouble working something out with regards to javascript and Json. I have a function that contains a json object blah=function(i){ var hash= ({ "foo" : "bar", "eggs":"bacon", "sausage":"maple syrup" }); var j=eval(hash); // Convert to Object console.log(j.toSource()); // Yes I know it's only in firefox! cons...

Setting Hidden Field Value to JSON (jQuery/JavaScript)

var c = [{"Id":40,"Action":null,"Card":"0484"}]; $('#hidJson', window.parent.document).val(c); alert($('#hidJson', window.parent.document).val()); // returns [object Object] alert($('#hidJson', window.parent.document).val()['Card'); // returns undefined I'm in a legacy app. I have had to put in a fix where an IFrame needs to get a pack...

How to skip before filters for json/xml requests in rails

I found a way to skip before filters based on the format, as seen below, but I'm wondering if there is a better way since this clutters things and isn't very DRY. before_filter do |controller| :current_cart unless controller.request.format.js? end If I don't do this, json requests fail because the current_cart method, and other meth...

JSON formatting (Sending JSON via jQuery AJAX post to Java/Wicket server)

I'm using jQuery to post JSON to a Java server, but I think my JSON must be wrong. Here's an example of my data and how I'm sending it: var lookup = { 'name': name, 'description': description, 'items': [{ 'name': itemName, 'value': itemValue }] } $.ajax({ type: 'post', data: lookup, dataType:...

$jQuery Tree from json data ---> .live is killing me

Hi, I'm trying to build a tree from json data, this data are loaded on demand from php files. My problem is that i can't find a way to get to lvl 3 ;). Here is my code: $(document).ready(function() { //Get the screen height and width var Height = $(document).height()/2; var Width = $(window).width...

Sanitize user input for display and allow all characters?

I need to be able to safely display user inputted text in the DOM and I'm currently using the following JS to do that (it limits what characters are accepted). But, now I'd like to allow all characters. How can I accept all characters, but encode them so that the user cannot execute a script or do anything bad. function displayUserInpu...

Need help parsing JSON on iPhone using json-framework

I'm currently using json-framework and need some help though parsing some JSON i'm getting from my server. Here is how the JSON looks: Like I said I already have the json-framework installed but I can't figure out how to actually parse it. Can someone please show me? Thanks! [ { "id":"0", "name":"name", "info":"This...

Is it possible to perform a cross site site request forgery attack on a URL that returns a JSON object?

I'm aware that there is a Cross site forgery attack that can be performed on a request that returns an array by overloading the Array constructor. For example, suppose I have a site with a URL: foo.com/getJson that returns: ['Puff the Dragon', 'Credit Card #'] This would normally be Javascript eval'd by my own site after an XHR re...