json

array of special characters to replace in a text, php, json

I have a huge text that i keep getting in a json format. When i receive them in json, for some special characters like ' " &copy, i receive them differently. i am using php and json to convert json into html. for example, i receive ' as \c101d (single quote) " as \c201d (opening quote) " as \c202d (closing quote) I am planning to keep ...

Rails Json response help

In my controller i have: @photo = Photo.find(:all) respond_to do |format| ... format.json { render :json => @photo.to_json) end so my response looks like: { "photo": { "updated_at":"2010-10-14T19:12:35Z", "photo_file_size":206422, "created_at":"2010-10-14T19:12:01Z" } ...

having trouble getting malformed JSON cross-domain

This is a very narrow scope of the code, but it is where the issue lies. function getJSON(tabUrl){ $.getJSON(tabUrl, function(data){ console.log(data); }); } I am using jquery 1.3 because getJSON in 1.3 can handle malformed JSON. The server I'm getting my json from uses the old parameter:'value' format. Here is the perplexin...

How to pass a string to a asp.net web service using jQuery/JSON/AJAX

Hi, As it is now I create a JavaScript object and then stringify it, put it in a hidden textbox and my code behind can read this string. I then use JSON.NET to parse the string which works fine. I now try to use ajax to post it to my web service but have some issues with how to send the string. I have tried many ways but gets the common...

Processing large JSON files in PHP

Hi, I am trying to process somewhat large (possibly up to 200M) JSON files. The structure of the file is basically an array of objects. So something along the lines of: [ {"property":"value", "property2":"value2"}, {"prop":"val"}, ... {"foo":"bar"} ] Each object has arbitrary properties and does not necessary share them with...

how to convert json object to string in android.. ?

hi, i want to convert from json object "{"CNo":80,"CName":"ganesh","CMail":"[email protected]","CMailType":"home","CPhNo":9878987776,"CPhNoType":"home","ClientNo":1}" to "{\"CNo\":80,\"CName\":\"ganesh\",\"CMail\":\"[email protected]\",\"CMailType\":\"home\",\"CPhNo\":9878987776,\"CPhNoType\":\"home\",\"ClientNo\":1}" ?? ...

API: return only JSON format

Hi all. I am developing a REST API for my web application for public use. I am tempted to provide only JSON as format for the response as it is more lightweight than XML (on large traffic, any byte counts). I think any programming language and platform is able to easily and effectively parse JSON, nowadays. So, what do you think abou...

Jersey Problem with Parsing a JSONArray

Hi, I'm trying to implement a Resource with the jersey framework. But if I call my resource, I will get a parsing exception, that the parser can't parse JSONArray datatype. Here's my resource structure: @Path("/books") @Consumes("application/json") public class BookResource { @GET @Produces("application/json") public JSONArray getAll...

json parse response can have one or multiple objects

hi. i need to parse this response in android using the android json parser but the thing i cant find the answer to anywhere is: how do i parse the data if for example "itineraries" can contain one or sometimes more objects of the type itinerary? if it contains one than it is returned like this but if it contains more it is returned with...

how to query json value for the passed in key

Hi, Very simple but didn't have enough time to do a quick search. Kindly help me with the following. public class myKeyValue { public int myKey { get; set; } public int myValue { get; set; } } IList<myKeyValue> is what gets javascript serialized. Following is what browser gets in one of its in-memory variable. [{"myKey":1,"my...

Is it possible to add a request header to a LoadVars when using GET (Flash AS2)

I'm working on a project built in Flash AS2. One of the things I need to do is load JSON data. In the past, I've had no problem with this - LoadVars works just fine. However, on this project, the JSON service that I'm calling requires the http request to include an ACCEPT header with "application/json". LoadVars has an addRequestHea...

Serializing Entity Framework problems

Like several other people, I'm having problems serializing Entity Framework objects, so that I can send the data over AJAX in a JSON format. I've got the following server-side method, which I'm attempting to call using AJAX through jQuery [WebMethod] public static IEnumerable<Message> GetAllMessages(int officerId) { SIBSv2Enti...

How to return JSON from a servlet based on request parameters

How do I use JSON in java servlet? Using the URL, to pass parameters from a POST servlet, the JSON would respond based on the URL parameters. ...

Passing parameters from one to other servlet using POST

How do I pass parameters from ServletOne to ServletTwo using a HTTP POST through URL? For example: http://localhost/ServletOne?username=test If the passing of parameters is successful, a JSON text will appear in the JSP page. ...

jquery doesn't add my list elements to a dynamic injected <ul> list

Hey there I really don't know where the fault is all about. Here is my code: $(document).ready(function(){ $("#folderTree > li").live('click',function(){ var id = $(this).attr("id"); if($('#' + id).hasClass('folderClosed')){ $.ajax({ url: "libs/php/ajax/documents/treeHandler.php", type: "POST", ...

json invalid according to jQuery but not jsonlint

I have a .NET web service returning the following json: {"command":"getqcardjson","valuesets":[{"datatable":"eaa65990-8f88-45e0-966b-610858ad4cb6","values":[{"Id":"eaa65990-8f88-45e0-966b-610858ad4cb6","InternalName":"Alpha Profile","TableName":"Alpha Profile","OnMainMenu":"","DefaultDataSourceId":"bb4d1622-2e48-40b6-bea7-6355d701445c",...

jQuery / AJAX - response format

Hi I was wondering what's the best "format" for the data that gets sent back to the javascript to be in? When should I use a JSON string or just plain HTML? Are there any other options besides these two? ...

Serializing Interface objects to JSON

I have a number of interfaces I use to pass business objects around in my application. Using Ninject, I can do whatever I want with them without needing to know the type of the actual object; in this case, most of them are actually various Linq to Sql objects that implement the interface. For example, I have a Linq to Sql object called ...

JSON corresponding to an XML with attributes

Hi all. I am designing an API for my webapp. I was thinking to support only JSON responses (not XML) because more streamlined. But I have just bumped to this XML: <folders> <folder id="123" private="0" archived="0" order="1">Shopping</folder> </folders> and I was wondering how the corresponding JSON would be. I have the feeling...

Should I use single or multiple configuration files for Code Generation

I have a php script that generates php and javascript wrapper classes that handle json marshalling based on a configuration file. My initial plan was to have a single config file that generates all the classes used by the application. However, my team lead suggested I use a separate file for each feature, to avoid creating a gigantic co...