json

Simple way to serialize ConfigurationElement into JSON

I need to take a portion of my xxx.config custom configuration and serialize it as JSON directly into my page. Using DataContractJsonSerializer yields {"LockItem":false} Which is similar to the response from XmlSerializer. I can't seem to find an override that gives me control over the serialization process on System.Configuration ...

Can I return JSON from an .asmx Web Service if the ContentType is not JSON?

I would like to post a form using ajax and jquery to a .asmx webservice and return the value from the webservice as JSON. I'm using ASP.NET 4.0. I know that in order to return JSON from a webservice the following needs to be set (1) dataType: "json" (2) contentType: "application/json; charset=utf-8", (3) type: "POST" (4) set the Data t...

Is there an existing tool for jsonp like fetching of xml in jquery?

Hi, For a web service I'm developing I would like my embedded code (on the client's site) to fetch an xml file from my sever script which resides on my domain. As this is a cross-domain request I figured to use jsonp as it seems the de facto standard for such apis. However, for my application it would be easier for me to use xml inste...

Fast JSON serialization (and comparison with Pickle) for cluster computing in Python?

I have a set of data points, each described by a dictionary. The processing of each data point is independent and I submit each one as a separate job to a cluster. Each data point has a unique name, and my cluster submission wrapper simply calls a script that takes a data point's name and a file describing all the data points. That sc...

Grails JSON array

I'm converting a list of Foo objects to a JSON string. I need to parse the JSON string back into a list of Foos. However in the following example, parsing gives me a list of JSONObjects instead of Foos. Example List list = [new Foo("first"), new Foo("second")] def jsonString = (list as JSON).toString() List parsedList = JSON.parse(jso...

REST/JSON: Should I include a newline after the JSON string?

If I'm returning ["foo"] from a RESTful web query, Which of these is more proper? Will pedantic REST parsing die on the newline? ["foo"]\n (with newline, Content-Length=8) ["foo"] (no newline, Content-Length=7) For easy regression testing I like the form with the newline, but I want to make sure I won't be breaking any appl...

How to change the JSON output format and how to support chinese character?

Currently I using the following code to get my JSON output from MySQL. <?php $session = mysql_connect('localhost','name','pass'); mysql_select_db('dbname', $session); $result= mysql_query('SELECT message FROM posts', $session); $somethings = array(); while ($row = mysql_fetch_assoc($result)) { $somethings[] = $row;...

How does JSON compare to XML in terms of file size and serialisation/deserialisation time?

I have an application that performs a little slow over the internet due to bandwidth reasons. I have enabled GZip which has improved download time by a significant amout, but I was also considering whether or not I could switch from XML to JSON in order to squeeze out that last bit of performance. Would using JSON make the message size s...

Extjs cache JSON request

Hi i'm using Extjs and i have built a grid with editable cells. One of this cells must be a combobox that takes its options from a script that generates the json data. The code for the grid and for the combobox-cell-editor works but i want that the json request to the script is cached after the first time, is it possible? I write some c...

replace double quotes to parse JSON in PHP

hi, i have following json format { "status": "ACTIVE", "result": false, "isworking": false, "margin": 1, "employee": { "111": { "val1": 5.7000000000000002, "val2": "9/2", "val3": 5.7000000000000002 }, "222": { "val1": 31.550000000000001, ...

Problem with XStream Marshalling to return xml and json

When i use new XStream().toXml(someObject); it returns following xml... <response> <status>SUCCESS</status> <isOwnershipVerified class="boolean">false</isOwnershipVerified> </response> and, when i use new XStream(new JsonHierarchicalStreamDriver()).toXml(someObject); it returns following json... {"response": { ...

c# -> javascript, Json decoding misses property

Hi all, I have a c# object (below) that I'm trying to send to my javascript. My problem is, that while I can iterate over the items in the list, I can't get to the string-property ('Period'). Referencing the object in JS shows no property at all. After Json-encoding in c#, I can still see the property just before returning it to calle...

google-app-engine: json module

Hey i'm using JSON with appengine. I'm using json for comunication, so in the python side i have import json the error i'm getting is this: <class 'django.core.exceptions.ViewDoesNotExist'>: Could not import views.ganttapp. Error was: No module named json In my stand alone this works great, is there any problem with json on the ap...

Convert JSON flattened for forms back to an object

I am required (please therefore no nit-picking the requirement, I've already nit-picked it, and this is the req) to convert certain form fields that have "object nesting" embedded in the field names, back to the object(s) themselves. Below are some typical form field names: phones_0_patientPhoneTypeId phones_0_phone phones_1_patientPh...

How to declare and use the name of a function from a json object?

Hello, I have a json object collection of geo locations that I build in the server. Each of those objects has two properties: "marker" and "onClick". Marker is for storing a Google Maps marker object and the onClick stores the name of the function to be called when that marker is clicked on the map. When I'm pushing the location obje...

ASP.NET XML to JSON for httphandler

Can anybody recommend the best way to do this? Should I use JSON.NET? ...

Serializing Python bytestrings to JSON, preserving ordinal character values

I have some binary data produced as base-256 bytestrings in Python (2.x). I need to read these into JavaScript, preserving the ordinal value of each byte (char) in the string. If you'll allow me to mix languages, I want to encode a string s in Python such that ord(s[i]) == s.charCodeAt(i) after I've read it back into JavaScript. The c...

using javascript setTimeout to see if div has loaded

I'm loading remote data using dynamic script tags and JSON. the remote page that I'm displaying on my website has a div in it that I use to load content into. The problem is the javascript functions do not see the div as the page loads because it is remote data. if I set a timeout of about 300 it usually works and my javascipt can see t...

couldn't serialize an NSObject, in Json

Hello I'm writing an iPhone app using JSON framework. I couldn't serialize an NSObject, I found only serialize for nsstring, nsarray, nsdata, but I want to serialize a generic object from template object; any class library for this? I have a user class, with userid, username and password. I want to serialize this class and send to serve...

Where is the System.Runtime.Serialization.Json namespace?

Hi, I've added the reference to System.Runtime.Serialization dll to my project but still can't find the System.Runtime.Serialization.Json namespace and hence can't find the DataContractJsonSerializer class. What am I missing here? ...