json

Nested JSON objects - do I have to use arrays for everything?

Is there any way to have nested objects in JSON so I don't have to make arrays out of everything? For my object to be parsed without error I seem to need a structure like this: {"data":[{"stuff":[ {"onetype":[ {"id":1,"name":"John Doe"}, {"id":2,"name":"Don Joeh"} ]}, {"othertype":[ {"id":2,"company":...

Best JSON library to get JSON data for Django?

What is the best JSON library to get JSON data for Django, 'simplejson' or otherwise? thanks very much ...

MooTools: Events

Let's save I have an Element: var el = $('mooo'); What's the easiest way to set its 'onclick' attribute or event (it may already have one)? ...

Java JSONObject does not maintaing the order of which I put things into. Trying to send into WCF service.

This is a weird issue. I understand JSON is supposed to be unordered and the implementation of java.lang.JSONObject specifically mentions that it is unordered. However, it puzzles me because I would expect the way I call the put(); methods it should keep my order. Maybe that contradicts what I just said in the beginning though. I am us...

Geolocation information with asp.net mvc (cross domain security problem)

How can I get a user's geolocation information (City and Country - internet service provider and internet speed would also be great) based on their IP address? I've searched and found several tools for doing this but I seem to run into problems using them with asp.net mvc. Many of them relate to using json and the "security risk" invol...

get json using php

I need to get the json data from, http://vortaro.us.to/ajax/epo/eng/ + 'word'+ "/?callback=?" working example (not enough reputation) I know how to do it in javascript, But I need my php file to get this data, It needs to be server side, Thanks I'm new I have spent all day trying to figure this out. fopen and fread isn't working, <...

jsonp -> json_decode()

for some reason I can't get the information out of a returned jsonp string, <?php // Created by Talisman 01/2010 ★✩ $vorto = $_GET['vorto']; // Get the Word from Outer Space and Search for it! if (isset($vorto)) { echo $vorto; } else { $Help = "No Vorto -> add ?vorto=TheWordYouWant to the end of this website"; echo $Help; } ...

Not all Ajax content loading on one domain

I have the domain http://whatthecatdragged.in/ forwarded (cloaked) to http://moppy.co.uk/wtcdi/ The root page (index.html) uses Ajax to load the content. At the original host (moppy.co.uk/wtcdi) the page and all content loads. However, at the domain forwarded domain (whatthecatdragged.in), some of the content does not load. Has it somet...

Json communication between flash and javascript

Hi, note: using django/python/javascript/flash So its been two days since I'm stuck at the error. I did the things you told me to and found a couple of ways around it but nothing worked. These are the results. Javascript does not receive the normal string it has to be a json object so. in views.py somestring = json.dumps("HELLO WORL...

zend json and object's private attributes

From my reading, I understand JSON to only work with public attributes. Is there a way to get it to work with private attributes? Would the magic getter (__get) do this? TIA ...

How to send raw post data in a Rails functional test?

I'm looking to send raw post data (e.g. unparamaterized json) to one of my controllers for testing: class LegacyOrderUpdateControllerTest < ActionController::TestCase test "sending json" do post :index, '{"foo":"bar", "bool":true}' end end but this gives me a NoMethodError: undefined method `symbolize_keys' for #<String:0x00000102...

String response not getting in .getJSON

My controller method just return String value. When I called JSON from my view page, I don't see any value. controller method public string test(int i) { return "Hello world " + i; } Inside View, $.getJSON(['../Feeds/test/', 1, '/'].join(''), function(json) { alert(json.toString()); }); If I run this into Mozilla, I can se...

How to set Request.IsAuthenticated to true when not using FormsAuthentication.RedirectFromLoginPage?

I am using Form Authentication and sending an Aajx request to the server for authentication. Based on the json result, the client decides where to go and what to do. That is the reason I am not using FormsAuthentication.RedirectFromLoginPage to not interfere the ajax/json response. In this case Request.IsAuthenticated returns false, eve...

Unable to Read Data from Jquery getJSON Request

I'm requesting a json feed using the standard jquery getJson request. The json url is not hosted on my domain. $.getJSON('myfeed.json?jsoncallback=?', function(data){ console.log(data); }) However using Firebug, I'm not seeing any data logged in the console. But I can see the json data has been loaded as is available when I look und...

Root Nodes in JSON

I'm tasked with defining communication between two web apps. I've decided to use JSON for this. How common is it to have a root node in the JSON? Let's say we have a car object. This is the JSON with "Car" being the root node: {"Car": { "Make":"Mustang", "YearBuilt":"1999"}} So now let's say I have a Tire object and since w...

globalize2 with xml/json support

I'm implementing a distributed application, server with rails and mobile clients in objective c (iPhone). To enable internationalization, I use the rails plugin 'globalize2' by joshmh. However, it turned out that this plugin does not translate attributes when calling to_xml or to_json on an ActiveRecord. Does anyone know of a workaround...

How to send JSON requests to a remote server ?

I'd like to send a JSON rpc to a remote web-server. The client-side of my application must be completely javascript. The choice of the client library should be independant from the json-rpc implementation on the server-side. I don't need json-over-http. Simple json objects over tcp/ip is enough for my use-case. Thanks ...

Passing Objects from Views/Javascript to MVC Action

I am using MVC. I have a view model which contains a Business object. I need to post this Business Object back to a controller action using AJAX. For now, I am using Url.Action function to create my request Url for AJAX and pass the Business Object id as a request parameter to the action. I then have to retrieve the object from the dat...

JQuery: Having trouble properly displaying table

Hello! Recently I've been working on a web application that is using JQuery to parse the JSON and display it in the HTML view. I cannot figure out why the table the following code outputs ends the tag immediately after the first .append method. $("document").ready(function() { $.getJSON("http://localhost:1909/encoders", function(d...

Javascript on iPhone Web App: JSON for loop not displayed

I have the following code to display JSON results from an AJAX request as an unordered list. It works well enough in Safari but on Mobile Safari on the iPhone the raw data displays but the UL does not. In fact the for loop isn't triggered. $("#results").append(data); var songdata = JSON.parse(data); var i = 0; for (i=0;i<=songdata.to...