json

What is the best way of pulling json data in terms of performance?

Currently I am using HttpWebRequest to pull json data from an external site, and the performance was not good. Is wcf much better? I need expert advice on this.. ...

How to encode 2 dimentional PHP array to Javascript Array?

Here's my problem, i have a php array like this: $output = array(array(1,1,1,1),array(2,2,2,2),array(3,3,3,3)); after the array was encoded to json i got this: $output = {"1":[1,1,1,1],"2":[2,2,2,2],"3":[3,3,3,3]} all i want is to pass the PHP array to Javascript so that the JS looks like this: var output = [[1,1,1,1],[2,2,2,2],[3...

JSON Serializing Django Models with simplejson

I'd like to use simplejson to serialize a Django model. Django's serializer doesn't support dictionaries... and simplejson doesn't support Django Querysets. This is quite a conundrum. In the model there's sponsors that have a Foreign Key to sponsor level, I'm trying to group all the sponsors that belong to a certain sponsor level togeth...

Is there a way to dump a C struct?

I've written a program to probe the limits of a system's C time.h functions and dump them out in JSON. Then other things which depend on those functions can know their limits. # system time.h limits, as JSON { "gmtime": { "max": 2147483647, "min": -2147483648 }, "localtime": { "max": 2147483647, "min": -2147483648 }, "mktim...

Good Jquery Autocomplete plugin consuming JSON ...

I have my customers name in json format i have to use it in a textbox such that it auto completes to give list of users ... Any good Jquery Autocomplete plugin consuming JSON.. I have gone through a similar question of stackoverflow but it didnt help me http://stackoverflow.com/questions/188442/whats-a-good-ajax-autocomplete-plugin-fo...

What are some key gotchas when working with Json responses?

I'm working on an ASP.Net MVC project and have been learning a few little tricks with JSON objects that made me scratch my head for quite a while. For example, ensuring that when I call $.getJSON() from jQuery, I actually need to make sure my JSON is returning an object, not just a string value (well, D'uh! right?). What are some of th...

How do I create Javascript array(JSON format) dynamically?

I am trying the create the following var employees = {"accounting": [ // accounting is an array in employees. { "firstName" : "John", // First element "lastName" : "Doe", "age" : 23 }, { "firstName" : "Mary", // Second Element ...

How can I override the Ext JS JsonStore timeout?

I have a JsonStore that needs to return from an HTTP request that takes longer than 30 seconds. Setting the "timeout" property on either the JsonStore config doesn't override the 30-second timeout, neither does setting a proxy (rather than just setting the url property) and putting a timeout on the proxy. How can I extend this timeout?...

Compare two JSON objects in Java

I'm looking for a JSON paring library that supports comparing two JSON objects ignoring child order, specifically for unit testing JSON returning from a web service against an expected value. Do any of the major JSON libraries support this? the org.json simply does a reference comparison. ...

MODx: Wrong Result using Ditto and JSON output

I'm using the following Ditto call: [!Ditto? parents='8' &dateSource='event_date' &summarize='100' &format='json' !] But Ditto ignores the dateSource param as long as format is set to JSON. I'm using MODx evo and Ditto 2.1.0. Any ideas? ...

JAVA--how to parse a JSON and turn its values into an Array?

public static void parseProfilesJson(String the_json){ try { JSONObject myjson = new JSONObject(the_json); JSONArray nameArray = myjson.names(); JSONArray valArray = myjson.toJSONArray(nameArray); for(int i=0;i<valArray.length();i++) { String p = nameArra...

Jquery with SMARTY and JSON

table department(department_id, name) table category(category_id, department_id, name) I want to implement the idea that when i change department in drop down list, all categories will change according to the department value It 's my jquery script {literal} <script type="text/javascript"> $(document).ready(function(){ $('#departmen...

Django return a single record as JSON

Hi, I created a form for adding notes about a customer in our web admin. I am using jQuery and Ajax to submit the for. I would like the Django view to return the newly added note/record so I can append it to the customer notes table. My Ajax send is working, and the note is being saved, I just can't display the result. I have tried the...

Can I insert PHP variables into a JSON string?

I am using a REST API to POST attributes to a person using json. My request body looks like this: $requestBody = ' { "attribute": { "@id": "", "@uri": "", "person": { "@id": "222", "@uri": "https://api_name_removed.com/v1/People/222" }, "attributeGroup": { ...

Comparison of JSON Parser for Objective-C (JSON Framework, YAJL, TouchJSON, etc)

As far as I know, there are three JSON Parsers for Objective-C, JSON Framework, YAJL, and Touch JSON. Then, These three would have their own characteristics. For example: YAJL can be used as a SAX style parser. JSON Framework has relatively long history and is widely used. Touch JSON parses NSData instead of NSString. In addition, as f...

getJSON not working. got tired of js problems.

function addSearchPattern(file, aStatus, aRule, aExpression, aCategory) { $.getJSON(file, { status: aStatus, rule: aRule, expression: aExpression, categoryID: aCategory }, function(data){ if(data.errors.length > 0) { var errorText = ''; $.each(data.errors, fu...

String to JSON object.

Hi, I am using a JSON object to create graphs with Google visualization. I am trying to design the data source. For this i am creating a JSON object on my browser. var JSONObject = { cols: [{id: 'date', label: 'Date', type: 'date'}, {id: 'soldpencils', label: 'Sold Pencils', type: 'number'}, {id: 'soldpens', label: 'Sold ...

How do I pass Json data back to the client from a standard ASP.NET WebForm uising the Response object?

I'm trying to return simple Json data back from a standard WebForm. It sounds very dumb, but I actually need this to happen. I'm using MVC, and this is one of only 3 pages that I use that is NOT an MVC view. Otherwise, I'd write a controller to return Json(myData), but I can't do that. Here is what I'm doing: var serializer = n...

Error calling a WCF REST service using JSON. length quota (8192) exceeded

I’m having a WCF REST service hosted in IIS using .NET 4 RC. The POST calls to the service are serialized using JSON. Everything works fine until the size of one of the DataMember (string) is longer than 8K. In this case I receive the error described below indicating the MaxStringContentLength has been exceeded. The maxStringContentLengt...

json_encode on class with magic properties

I am trying to json_encode an array of objects who all have magic properties using __get and __set. json_encode completely ignores these, resulting in an array of empty objects (all the normal properties are private or protected). So, imagine this class: class Foo { public function __get($sProperty) { if ($sProperty == ...