json

How to avoid 'null' strings when binding JSON data on client side

Is it possible to avoid having 'NULL' stings on the client when binding JSON data to HTML UI? I'm using ASP.NET MVC + jQuery + jTemplates. Data is coming from linq-to-sql classes and these classes have quite a lot of nullable properties. When such properties get serialized and transferred back to client I end up with such JSON: [{"Id":...

XML Return Msg

This happens once in a while, once a save button on a media screen is clicked, white screen appeared and the upper left hand corner reads: success Usually after clicking a save button, the page will nevigate from a media screen back to a nalmal web page which is written in C#.User need to click a back and refesh butons to be able to p...

Extend JQuery Validator Plugin with custom method

I added a custom validation method to validate a password. However, it does not matter if the JSON I get is: {"success":true} or: {"success":false} The field password never validates. $(document).ready(function() { // Ad custom validation $.validator.addMethod('authenticate', function (value) { $.getJSON("./json/au...

get json data back from ajax call

Hello, my question is: How can my php script send json type data and received back into the success or complete function? I was trying to get this chatfunction to work on my website Because it diddn't work, I created a minimized portion off the code to check if it had something to do with the json method. I only tested if I could get a...

undefined error with ajaxcall to receive json data

Hello, my problem is that I can not solve this problem If I call the php script, all I get is an undefined error this is the code I use for testing AND this is the original code from the creator that is giving me a headache function startJsonSession(){ $.ajax({ url: "jsontest.php?action=startjson", cache...

Why are escape characters being added to the value of the hidden input

<body> <div> <?= $_POST['msg'] ?> </div> <form id="frm" method="post"> <input type="hidden" name='msg' value='{"field0": "Im a string", "field1": 84, "field3": "so am I"}' /> <input type="submit" value="test" /> </form> </body> When the form is posted, the following string is displayed between the div tags. {\"field0\...

Problem passing JSON data using jQuery $.ajax() to .NET MVC Action w/ custom BindingModel

I am trying to pass JSON data from the client browser to an ASP.NET MVC Action using jQuery $.ajax() and bind it to a .NET class using a custom ModelBinder. THE CLIENT JAVASCRIPT: $('#btnPatientSearch').click(function() { var patientFilter = { LastName: 'Flinstone', FirstName: 'Fred' }; var jsonData = $.toJSON(patientFi...

Crunching json with python

Echoing my other question now need to find a way to crunch json down to one line: e.g. {"node0":{ "node1":{ "attr0":"foo", "attr1":"foo bar", "attr2":"value with long spaces" } }} would like to crunch down to a single line: {"node0":{"node1":{"attr0":"foo","attr1":"foo bar","attr2":"value...

How to filter a very big json string without looping every object in it?

Hi, I'm currently developing a calendar with all standard views (day, week, month). To load my calendar events I use JSON. When the events are loaded I have to map them on the active view (day, week or month). For each view I only need a particular set of events, the events between the date range of the current view (=timeframe). S...

JsonResult is returning view html rather than a serialized object when called from jQuery Get()

I'm trying to get a json serialized object from within an MVC user control using jQuery. The problem is the result coming back is the full HTML for the page that contains my control. The page and the control use the same controller. I've tried breaking on the method I'm calling in the controller and it never gets hit. I've tried vari...

How does JSON work? If I do a jquery $.post with a return type of json, how does the data get returned?

Hi, If I do a post from jquery like so: $.post("Row/getRowNames", { currRow: "MyRow", offset: 3 }, function(rowNames) { /* How do I interpret the data to }, "json"); How do I interpret the data rowNames that's passed back from the method in the controller? I need to turn the json result into an array of s...

JavaScriptSerializer.MaxJsonLength exceeded. What's the best practice for handling this?

I've got a large amound of data I'm sending down to the client using jQuery's $.ajax() function. I'm calling a method in a ASP.NET web service that returns the JSON data. Everything is great for most searches, but when I've got a large data set to return I run into a issue with the JavaScriptSerializer MaxJsonLength property. What's the ...

Json.NET serialization pre and post calls

Hi, I am using Json.NET to serialize an object graph. For each object that is serialized or deserialized, I want to call a method on that object before the serialization takes place. For e.g. all my objects implement an interface INotified with a method OnSerializing. I want OnSerializing to be called before the object is serialized. I...

iPhone NSArray from Dictionary of Dictionary values

I have a Dictionary of Dictionaries which is being returned to me in JSON format { "neverstart": { "color": 0, "count": 0, "uid": 32387, "id": 73129, "name": "neverstart" }, "dev": { "color": 0, "count": 1, "uid": 32387, "id": 72778, "name": "dev" }, "iphone...

PHP's json_encode does not escape all JSON control characters.

Is there any reasons why PHP's json_encode function does not escape all JSON control characters in a string? For example let's take a string which spans two rows and has control characters (\r \n " / \) in it: <?php $s = <<<END First row. Second row w/ "double quotes" and backslash: \. END; $s = json_encode($s); echo $s; // Will outpu...

Code for communcation between PHP and AS2?

I have a Flash developer I'm working with. This person is building a tool in AS2 that will provide an interface that will send voting data (firstname, lastname, email address, votes (there are 100 items in categories and users will be able to choose some subset to declare "best"). All fair enough, Flash dev will POST data to a PHP app I...

Checkboxes will not check in IE7 using Javascript, and yet no errors

Okay I'm totally confused on this one. I have a script that receives a bunch of values from a JSON object and creates a bunch of checkboxes and either checks or unchecks a these checkboxes based on their values. This script treats me like a woman treats me... "If you don't know what's wrong, then I'm not going to tell you..." The scr...

Fastest way to iterate through JSON string in Javascript

Hello, I have been using $.each of the jQuery framework to iterate through a JSON string that I receive via an AJAX call. Now this string is sometimes quite huge and as a result IE6/7/8 crawl as a result. I am wondering if there is a faster way to iterate through the entire data. Thank you for your time. ...

Binder for long{} in MVC

[AcceptVerbs( HttpVerbs.Post )] public JsonActionResult<BaseAsyncResponse> Add( long[] IdList ) { for (int i = 0; i < IdList.Length; i++) { // do something } } var o = { url: addButton.action.url , method: addButton.a...

Convert JSON array to an HTML table in jQuery

Is there a really easy way I can take an array of JSON objects and turn it into an HTML table, excluding a few fields? Or am I going to have to do this manually? ...