json

JSON to string in Prototype

The people on this website seem to know everything so I figured I would ask this just in case: Is there a method/function in prototype that converts a JSON object to a string that you can store in a cookie? If not,..i'll just use another external library. Thanks, Andrww ...

Using XTemplate with SimpleStore in Ext

I am currently adding some functionality to some old code. There used to be a template which took a flat array of items and spat out some HTML, now the data is coming from a simple store which reads some JSON.. var allwords = [ ['abacteriano', 'abacteriano'], ['abacterial', 'abacteriano'], ['abciximab', 'abciximab'], etc.. ...

How to pretty-print JSON script?

Is there a (*nix) command-line script to format JSON in human-readable form? Basically, I want it to transform the following: { foo: "lorem", bar: "ipsum" } ... into something like this: { foo: "lorem", bar: "ipsum" } Thanks! ...

Parsing JSON using JQuery

I have a JSON as follows { columns : [RULE_ID,COUNTRY_CODE], RULE_ID : [1,2,3,7,9,101,102,103,104,105,106,4,5,100,30], COUNTRY_CODE : [US,US,CA,US,FR,GB,GB,UM,AF,AF,AL,CA,US,US,US] } I need to retrive the column names from the columns entry and then use it to search the rest of the entries using jquery. For example I ...

converting unicode for mysql and JSON

Hello, I have some html that was inserted into a mysql database from a csv file, which in turn was exported from an access mdb file. The mdb file was exported as Unicode, and indeed is unocode. I am however unsure as what encoding the mysql database has. When I try to echo out html stored in a field however, there is no unicode. This i...

Converting A Dataset to JSON using .net 3.5 in C#

Hi All... I have been searching for a simple way to convert a dataset from a postgres database to JSON for use in a project that i am building. This is my first time using JSON and I have found it really tricky to find a simple way of doing this. I have been using a stringbuilder at the moment to create a JSON string from the informatio...

Is there a decent JSON editor around?

I'm looking for a JSON editor that is able to do syntax checking and outline view. Browser-based editors are not an option as they are clumsy for editing lots of local files. Eclipse plug-in would be ideal, but I would be happy with anything that works. I found only two so far, those in Aptana Studio Pro and Spket IDE (both available ...

getJSON call working on IE 7 but not Firefox 3...

Hi all, I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON: $.getJSON("http://localhost:17245/Service.svc/?format=json", function(data) {alert(data.id);}); This call works fine in IE7 and I can call the service wit...

Is there a pattern for using XML for no-overhead object serialization?

In the same way that you can use JSON in javascript? At least the static properties? Or maybe even for hash-table streaming? Is it oversimplistic about hoping to find something like Object.Serialize(stream) where stream is a file, overrideable with your choice of other likely candidate targets, using some default format, say XML? W...

What is the best way to serialize a ModelForm object in Django?

I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of the form. However, the d...

JSON object for just an integer

Silly question, but I'm unable to figure out.. I tried the following in Ruby: irb(main):020:0> JSON.load('[1,2,3]').class => Array This seems to work. While neither JSON.load('1').class nor this JSON.load('{1}').class works. Any ideas? ...

Best way to filter domain objects for json output in an ASP.NET MVC application

If I'm rendering a regular view in asp.net mvc the only domain object properties that show up in my page the ones I specifically write out. For example: <div><%= Customer.FirstName %></div> However, if I serialize a domain object for json it will include every property. Example: public JsonResult Customer (int? id) { Customer cus...

jQuery not parsing JSON properly

I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like: jQuery.get(callUrl, function(data){ console.log(typeof data); jQuery.each(data.items, function(i,item){ console.log(i); ...

JSON parameters auto. convert to lowercase when ajax request made to MVC action method?

Would anybody know why my parameter is being "converted" to lowercase when it hits my ASP.NET MVC controller action? I can only assume it is being converted as looking at data value just prior to the ajax request it is in correct casing, but then when debugging my action method within .NET during the ajax request and checking the incomi...

jsonp request not working in firefox

I am trying a straightforward remote json call with jquery. I am trying to use the reddit api. http://api.reddit.com. This returns a valid json object. If I call a local file (which is what is returned from the website saved to my local disk) things work fine. $(document).ready(function() { $.getJSON("js/reddit.json", function (js...

JSON syntax for property names

What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ ) Is this valid var a={ "class": "Person", "name": "William Shakespeare", "birthday": -12802392000000, "nickname": "Bill" } ; Or is this: var...

JSON encode MySQL results

How do I use the JSON_encode function with mysql query results, do I need to iterate through the rows or can I just apply it to the entire results object? ...

consume a asp.net web service that returns json from an stand alone html page

I've developed a web service in asp.net and am able to test it from an in-project aspx page and can readily display the information that was returned in JSON format. I now need to consume the web service from a stand-alone html page. Does someone have experience with this? I'm puzzled by the part that would replace this <asp:ScriptMa...

What is JSON and why would I use it?

Sorry for asking what may well seem like a dumb question. I've looked on wikipedia and Googled it and read the official documentation, but I've still not got to the point where I really understand what JSON is, and why I'd use it. I have been building applications using PHP, MySQL and Javascript / HTML for a while, and if JSON can do s...

Return Json to jQuery with ASP.NET MVC

I have this code.. Models.Person p = new testmvc.Models.Person { Firstname = "yongeks", Lastname = "ucab" }; Models.Person p2 = new testmvc.Models.Person { Firstname = "lyn", Lastname = "torreon" }; string q = JavaScriptConvert.SerializeObject(new String[] { JavaScriptConvert.SerializeObject(p), JavaScriptConve...