json

IE7 not digesting JSON: "parse error" [resolved]

While trying to GET a JSON, my callback function is NOT firing. $.ajax({ type:"GET", dataType:'json', url: myLocalURL, data: myData, success: function(returned_data){alert('success');} }); The strangest part of this is that my JSON(s) validates on JSONlint this ONLY fails on IE7....

How can I use JSONP to download client-side javascript objects?

I'm trying to get client-side javascript objects saved as a file locally. I'm not sure if this is possible. The basic architecture is this: Ping an external API to get back a JSON object Work client-side with that object, and eventually have a "download me" link This link sends the data to my server, which processes it and sends it b...

Random JSON Generator

Hi, I need a tool which generates random JSON objects. I want to use this tool to do testing on my HTTP POST requests and use the random JSON object in it. Any suggestions? ...

JSON serialization of c# enum as string

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "name". Is there a way to get the enum as a string in my json without having to create a custom JavaScriptConverter? Perhaps there's an attribute ...

Using Jquery $getJSON How do I dynamically create data for the [data] parameter after Url param?

I have no problems getting the Json to work and parse the json return. I was just wondering how I could build a dynamic "whatever data is" and stick it into [data] to pass my parameters from there and not manually append them to the url. From jquery website example: $.getJSON("test.js", { name: "John", time: "2pm" }, function(json){ ...

php json jquery and select box

I have this php code $jsonArray = array(); $sql = "SELECT ID,CLIENT FROM PLD_SERVERS"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $jsonArray[] = array('id'=>$row['ID'],'client'=>$row['CLIENT']); } echo json_encode($jsonArray); And this js function autosearchLoadServers() { $.post("php/autosearch-lo...

Why does this JSON fail only in iPhone?

I'm using the JSON framework from http://code.google.com/p/json-framework. The JSON below fails with this error: -JSONValue failed. Error trace is: ( Error Domain=org.brautaset.JSON.ErrorDomain Code=5 UserInfo=0x124a20 "Unescaped control character '0xd'", Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x11bc20 "Object value...

GWT: How can I use JsonpRequestBuilder to handle a Json response of a list

My backend server function returns a list of json object to the caller. I would like to use JsonRequestBuilder to interact with this backend function I defined a AsyncCallback this way class MyCallBack extends AsyncCallback<List<MyObject>> { However, JsonpRequestBuilder does not this declaration AsyncCallback because the generic ty...

jQuery FullCalendar JSON date issue

I am integrating jQuery plugin FullCalendar, overall it has been really straightforward. I however have ran into a problem with adding events to the calendar. I am using ASP.NET MVC 1.0 and have found and followed this post. I am returning JSON to the FullCalendar and the events are getting bound, but they all show up as all day events....

Reading multiple json values with php

I am trying to read certain values from a json string in php, I am able to do a simple json string with only one value such as $json = '{"value":"somevalue"}'; Using this: <?php $json = '{"value":"somevalue"}'; $obj = json_decode(json_encode($json)); print $obj->{'value'}; ?> But when i try an get a value from t...

jQuery getJSON request returning empty on a valid request

I'm trying to grab some JSON from Apple's iTunes JSON service. The request is simple: http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsSearch?term=jac&amp;limit=25 If you visit the URL in your browser you will see some well-formed (backed up by jsonlint.com) JSON. When I use the following jQuery to make the...

Does JSONP scale? How many JSONP requests can I send before my page fills up with <script> tags?

Based on Please explain JSONP, I understand that JSONP can be used to get around the same-origin policy. But in order to do that, the page must use a <script> tag. I know that pages can dynamically emit new script tags, such as with: <script type="text/javascript" language='javascript'> document.write('<script type="text/javas...

Alternative to WhitePages API?

I'm using the WhitePages API ( developer.whitepages.com ) to get a phone type (landline or cellular) and the phone's service provider (Verizon, T-Mobile, etc), but they only have a personal API which limits you to 2 calls a second and/or 1,500 calls a day. The paid version, or "Pro", is a minimum of $500 a month and/or $0.10 a call. Doe...

How do I parse this json with php and upload some elements to Amazon S3?

Hello All, I have to import from an api http://somegoodrecipe.com/recipes/?format=json. It has 5 components: recipe_id recipe_title recipe_thumbnail (image) recipe_swf_url (flash) recipe_description I can use this to print it out: $json = file_get_contents("http://somegoodrecipe.com/recipes/?format=json", true); $decode = json_dec...

Making JSON Feed Work Server to Server

I have a JSON feed (which I don't directly control, I have to ask the server admins to update it), that is returning NULL, or otherwise not working when I try to access it from another server. The actual feed works fine, but I can't get it to work like a normal API. Why can I use Flickr, WhitePages, Twitter, etc's JSON APIs, but for: ht...

Ajax Form Validation in Struts 2.1.8 using jsonValidationWorkflowStack

I'm trying to get the ajax validations working in my Struts 2.1.8.1 application. I'm not using any of the built in struts ajax tags so that makes things slightly more complicated but I've been following the directions here: http://struts.apache.org/2.1.8/docs/ajax-validation.html My problem is that the jsonValidationWorkflowStack is alw...

Importing a large dataset into a database

I'm a beginning programmer in the relevant areas to this question, so if possible, it'd be helpful to avoid assuming I know a lot already. I'm trying to import the OpenLibrary dataset into a local Postgres database. After it's imported, I plan to use it as a starting seed for a Ruby on Rails application that will include information on ...

jQuery uses (new Function("return " + data))(); instead of eval(data); to parse JSON, why?

This link shows you that jQuery uses (new Function("return " + data))(); for older browsers, to parse a JSON string instead of eval(). What are the benefits of this? What if the JSON string isn't safe? ...

using different key for to_json :methods

When using :methods in to_json, is there a way to rename the key? I'm trying to replace the real id with a base62 version of it and I want that the value of base62_id has the key id. @obj.to_json( :except => :id :methods => :base62_id ) I tried to do @obj.to_json( :except => :id :methods => { :id => :base62_id } ) b...

Display text returned from json post call

I have the following javascript: $.post("/Authenticated/DeletePage/" + PageId); showStatus("Page deleted...", 10000); I would like to instead pass showStatus() text that is returned by the $.post() call, rather than hardcoded text. How do I do this? ...