json

Access element in json having numerical index

i have following format of json in which i want to asscess 0.4 , kem , 2 , 2000 values but it seems it doesn't have name index so how one can access it in jquery. when i paste following code in json viewer then i am getting numerical index for 0.4 , kem , 2 "td": [ { "@attributes": { "class": "odd" }...

Decode JSON with mochijson2 in Erlang

I have a var that has some JSON data: A = <<"{\"job\": {\"id\": \"1\"}}">>. Using mochijson2, I decode the data: Struct = mochijson2:decode(A). And now I have this: {struct,[{<<"job">>,{struct,[{<<"id">>,<<"1">>}]}}]} I am trying to read (for example), "job" or "id". I tried using struct.get_value but it doesn't seem to work...

Strange problem with Page Method JSON result.

I have the following JavaScript to populate a dropdown. When I single step into populateResourceList, the value for jsonList is shown below the code. However, this method fails on the for statement with the error jsonList.Table is undefined What am I doing wrong? function populateResourceList(jsonList) { var listItems = "...

Problem showing modelstate errors while using RenderPartialToString

Im using the following code: public string RenderPartialToString(ControllerContext context, string partialViewName, ViewDataDictionary viewData, TempDataDictionary tempData) { ViewEngineResult result = ViewEngines.Engines.FindPartialView(context, partialViewName); if (result.View != null) { Strin...

Retrieving Json Array

Hi, I am trying to retrieve the values from the following url: http://rentopoly.com/ajax.php?query=Bo. I want to get the values of all the suggestions to be displayed in a list view one by one. This is how i want to do... public class AlertsAdd { public ArrayList<JSONObject> retrieveJSONArray(String urlString) { String result = que...

JSONPBehaviour and multiple formats from WCF service.

Hi, I have a WCF service which I would like to product XML and JSON depending on the URI template. So in my service contract I have methods like the following [ServiceContract] public interface MultiFormatContract { [OperationContract] [WebGet(UriTemplate="/json/data", ResponseFormat = WebMessageFormat.Json)] [JSONPBehavior(callb...

Using Facebook graph to get the fans of a fan page?

I have a fan page located at http://www.facebook.com/shop4tronix. I can access info on this page by going to: http://graph.facebook.com/shop4tronix However, I want a list of all the fans of my page returned. I figured something like this would work: http://graph.facebook.com/shop4tronix/fans But it doesn't. Is there any way to get ...

How to add a view for the json result in asp.net mvc?

I returned json result from a controller but how can i add a view that uses this json result.. public class MaterialsController : Controller { ConstructionRepository consRepository = new ConstructionRepository(); public JsonResult Index() { var materials = consRepository.FindAllMaterials().AsQueryable(); r...

MVC2 Json request not actually hitting the controller

I have a JSON request, but it seems that it is not hitting the controller. Here's the jQuery code: $("#ddlAdminLogsSelectLog").change(function() { globalLogSelection = $("#ddlAdminLogsSelectLog").val(); alert(globalLogSelection); $.getJSON("/Administrative/AdminLogsChangeLogSelection", { NewSelection: globalLog...

Special character in "entrée" cannot be displayed correctly if defined in a separate javascript file

Example: The following string is defined in a json.js file. var test = "One complimentary entrée with the purchase of an entrée."; It is included in an index.html file by <script type="text/JavaScript" src="./json.js"></script> When the string is displayed in UI, it shows up as "One complimentary entr�e with the purchase of an...

Django: Difficulty loading data

Here are some models I am trying to load data for: class School(models.Model): name = models.CharField(max_length=200) def __unicode__(self): return self.name class RequirementSet(models.Model): offeringSchool = models.ForeignKey(School) name = models.CharField(max_length=200) def __unicode__(self): ...

One-liner javascript to collect values from object graph?

Given the following object graph: { "children": [ { "child": { "pets": [ { "pet": { "name": "fido" } }, { "pet": { "name": "fluffy" } ...

JQuery Json error: Object doesn't support this property or method

ERROR: Microsoft JScript runtime error: Object doesn't support this property or method here is how the json2 is calling from: **var json = JSON2.stringify(settings.data);** i am using WCF service to pull the data and its very simple for the purpose of test and it does returning me the data from wcf service but it fails on json2.j...

Pros and cons of using JSON for WCF service

What are the pros and cons of the following 2 cases: Case I: Traditional way: Add service reference in project. Create object and Get data from service on server side and bind to asp.net grid. Case II: Update Service for JSON behavior. Add service reference in project. Call service from javascript to get data. Bind data to jquery gri...

jQuery - getting the id of the item selected

I have a basic jQuery selector question. Let's say I'm parsing JSON and generating a row of data for each item in my result set. On each item row, I want an action button. What is the best practice to script that button so its click action can reference the data specific to that row? Starting with the block below, how do I generate a ...

asmx web service returning xml instead of json in .net 4.0

i have just upgraded a test copy of my site to asp.net 4.0 and have noticed a strange issue that only arises when i upload the site to my server. the site has an asmx web service that returns json, yet when i run the site on my server it returns xml. it as been working fine in asp.net 3.5 for over a year. the webMethod is decorated wi...

cannot output a json encoded dict containing accents (noob inside)

Hi all, here is a fairly simple example wich is driving me nuts since a couple of days. Considering the following script: # -*- coding: utf-8 -* from json import dumps as json_dumps machaine = u"une personne émérite" print(machaine) output = {} output[1] = machaine jsonoutput = json_dumps(output) print(jsonoutput) The result of thi...

Is it possible to send back a json array along with seperate variables

Hey guys I have an ajax jquery function that receives data from a php script. I want to return an array with all the online users which is retrieved from a mysql statement, and I want to send other separate variables I need for other purposes along with it. If anyone has any ideas, I would greatly appreciate it. NOTE: the example below i...

How to get error text in controller from BindingResult

I have an controller that returns JSON. It takes a form, which validates itself via spring annotations. I can get FieldError list from BindingResult, but they don't contain the text that a JSP would display in the tag. How can I get the error text to send back in JSON? @RequestMapping(method = RequestMethod.POST) public @ResponseBody...

How to save search, choose a recent search and then populate the form using jQuery and/or asp.net like priceline does

I want to do something similar to what priceline does. It saves the recent searches in a dropdown menu. When you pick one from the recent search. The form will be populated accordingly. (See screen shot http://yfrog.com/5fscreenshot20100501at105p) This is what I am thinking. (1) Save the searches into an array in a cookie (2), when a re...