json

Django: Include related models in JSON string?

Building on this question, now I have another problem. Given this, shipments = Shipment.objects.filter(filter).exclude(**exclude).order_by(order) \ .annotate(num_bids=Count('bids'), min_bid=Min('bids__amount'), max_bid=Max('bids__amount')) \ .select_related('pickup_address','dropoff_address','billing_address') return HttpRespon...

mysql table to json

Hi, I am planning yo use jquery UI Autosuggest for a search form.so I need a json output which can be used by Jquery UI Auto suggest. heres the database table name recent_tags I have tried this first connected to db $do = mysql_query("SELECT * FROM recent_tags where query like '%" . $_GET['qery'] . "%'"); while ($row = mysql_fetch...

secure json data transfer ?

I have bunch of screens (asp.net C#) capturing data and transferring it back to a web service using json. How can i encrypt content like passwords and decrypt it back in the C# code? ...

Json decoding in PHP

I am trying to decode JSON in php I sended using an ajax call in javascript (jquery). The javascript code: var editSchedule_data = { 'action' : 'editSchedule', 'eventid' : $('#eventid').val(), 'pixels_per_minute' :$('#pixels_per_minute').val(), artists: { artist: [] ...

reading json from jquery

Hi everyone I am trying to read some json and do 2 things. Insert some of the json data into a UL. Second thing is create a function that can be called from a anchor tag and displays the other data.Let me try explain with my code. My json looks like this [{lakeName:"Lake 1",lakeCode:"111",Readings[["24-Oct-10",12.5],["24-Oct-10",10.5],...

Iterating over a JavaScript object in sort order based on particular key value of a child object

Hello all Short version: I'm looking for the JavaScript equivalent of Perl's for my $key ( sort { $hash{$a}{foo} cmp $hash{$b}{foo} } keys %hash ) { # do something with $key } More detail: I have a JSON object which consists of a bunch of other JSON objects which have identical properties to each other, like a hash of hashes in ...

Deserialization problem while posting data (jQuery, json, mvc).

On my site I have simple form (by the way I'm using razor view engine): <form method="post" action="Mail/SendMailMessage" id="mailForm"> @Html.LabelFor(m => m.UserFirstAndSecondName)<br /> @Html.TextBoxFor(m => m.UserFirstAndSecondName)<br /> @Html.LabelFor(m => m.Email)<br /> @Html.TextBoxFor(m => m.Email)<br /> @Html.La...

is my code victim of same origin policy ?

Here is my code. You have to kindly look does it suffer from 'same origin policy' in this shape. The domain for HTML is (http://127.0.0.1/jqload.html) & php file (http://127.0.0.1/conn_sql.php). This is json format : [{"options":"smart_exp"},{"options":"user_int"},{"options":"blahblah"}] I actually want to append json data that I rece...

How to access Json Object which has space in its name?

Hi, Find below the json response... {"Object": {"PET ANIMALS":[{"id":1,"name":"Dog"}, {"id":2,"name":"Cat"}], "Wild Animals":[{"id":1,"name":"Tiger"}, {"id":2,"name":"Lion"}] } } In the above mentioned response, what is the way to find the length of ...

Returning Json Result with object name MVC

When a json result is returned by the controller the object name seems to be missing, I normally wouldn't mind but the flexbox jquery plugin requires the json result in a particular format. Flexcombobox expected format {"results":[ {"id":"1","name":"Ant"}, {"id":"2","name":"Bear"}, {"id":"3","name":"Cat"}, {...

Accessing JSON values with a variable

I'm trying to access JSON data with jQuery and grab a specific set of values based on a variable. I've done this before using [] but for some reason I can't figure out what is going wrong this time. My JSON file (being read in by getJSON, and named jsonmaker.php) looks like this: {"0107001":{"label":"Canada","x":"0","y":"0.34"},"01070...

Can we initialize an object/collection using LINQ in JSON-like syntax?

Can we do something like this or something similar? var staffs = { "Staff": [ { "ID" : 1, "Name" : "John" }, { "ID" : 2, "Name" : "Mark"} ] }; foreach (var staff in staffs) { Console.WriteLine("ID: {0}", staff.ID); Console.WriteLine("Name:...

problem with JSON array as input to REST service

Hello All, I am using Apache CXF RS to produce a REST service which accepts both XML and JSON as input. I use the default JSON provider i.e. Jettison. My trouble starts when my input json has an array in it. For example, { person:{ telephone:[ { type: "mobile", number: "123" ...

Pass XSL template output to XSL function

I am using XSLTJSON to convert my XML to JSON. My raw XML is not in the format that I want, so I first pass it through an XSL stylesheet to clean it up and then pass the output of that stylesheet into XSLTJSON. Right now I'm doing this by calling transformers serially. I'd like to streamline it and have only one call to the transfor...

Retrieving a property of a JSON object by index?

Assuming this JSON object: var obj = { "set1": [1, 2, 3], "set2": [4, 5, 6, 7, 8], "set3": [9, 10, 11, 12] }; The "set2" property may be retrieved like so: obj["set2"] Is there a way to retrieve the "set2" property by index? It is the second property of the JSON object. This does not work (of course): obj[1] So...

javascriptserializer date format issue

I am serializing a complex object with lot of properties of other Types and Lists to JSON form but the issue is with DateTime properties. I get the epoch time with JavascriptSerializer (rather than mm/dd/YYYY). Is there any way I can get the datetime in mm/dd/YYYY : HH.MM.SS form without modifying the class defination of the object i a...

Events not getting rendered with JSON feed.

I am trying to use a JSON feed to render events in fullCalendar. Here is the code. $('#calendar').fullCalendar({ editable : true, selectable : true, select : selectionMade, eventResize : eventsChanged, eventDrop : eventsChanged, selectable : tru...

HtmlAgilityPack: Convert parsed Javascript string to JSON

Hello! So, I am using the HtmlAgility pack (http://htmlagilitypack.codeplex.com/) to parse a script node and then I use regular expressions to parse out an object definition. The string I end up with is plain javascript that defines an object. Here is the sample Javascript I am trying to parse: <!--Module 328 Buying Options Table--> <...

JSON, MySQL, PHP - encoding problem

Hello guys. I have been trying to implement an AJAX call on a database returning a JSON file with PHP and eventually met the encoding problem. My database has some char fields with customers' names and, since it is in portuguese, european characters are pretty common. Hence the some results with those characters are returning null via ...

C# JSON to LIST extension method

From Scottgu's post i got the code to Serialize a collection to JSON object.(i)How to convert the JSON object back to List? (ii) I did not find JavaScriptserializer in System.Runtime.Serialization will the only code work for VS 2010? ScottGu's snippet namespace ScottGuHelper.JSON { public static class JSONHelper { public sta...