json

handling null in json or javascript

Im using an ajax json response to build some html to place in a webpage. Occasionally I'll come across an empty value in my json. This results in an empty object being placed into the html. I would prefer not to check that each value is not an object, as that doesn't seem efficient. Is there a better way? my code works like this ...

how to construct a json object using info from several javascript arrays

I have two js arrays already, say: names and values (with the same length), now I would like to construct a json object in certain format? For example: names = ["label1","label2","label3"]; values = [[[0,1],[1,9],[2,10]],[[0,89],[1,91],[2,1]],[[0,1],[1,9],[2,10]]]; I would like to have a json array data_spec in this format: [{ ...

Parsing enumeration member values when using JSON

Microsoft reports that Enumeration member values are treated as numbers in JSON. We're building the WebMethod output into a table by hand, so converting the member number into it's name on the client is possible, but it smells and would be less robust than converting it on the server, using Enum.GetName. For example, if we add or change...

overriding default property in an object

i want to make an ajax call to a php file that return a users info in json then take that data and put it in an object property example: System = { prop1= '' } i just want to override the prop1 property im using jquery to make the ajax call ...

IMPORTANT: Remove this line from json2.js before deployment

I have an ASP.NET app in which I've used Vertigo's SlideShow 2 silverlight image gallery component. All was working well and the app went through testing and suddenly, after a recent deployment I get an alert box that says: IMPORTANT: Remove this line from json2.js before deployment. This pops up after the Silverlight component load...

What is a good templating engine?

What is a nice templating engine to use in C#? I have XML or JSON as structured datasource. This data needs to be presented to users on the web in strict XHTML. I've been using XSLT mostly, but maybe there are more or better options? It needs to be used in C# or IronPython. ...

Flash, JSON and special chars, how read òàùèéì on flash with JSON?

Hello, I've a problem loading a JSON with flash class com.adobe.serialization.json.JSONIt works fine with everything except I haven't found a way to load special chars, so if i have { "json_text":"Hello, goodbye! I work fine!" } but If i need a special char like àùòèéì it won't work, I've tryied with { "json_text":"òàùèéì I r...

Is data.success javascript, jquery or json?

I googled data.success, but I could not proper document. What is data.success in the following jquery? Is it javascript, jquery or json? function remove_row(data){ if(!data.success) return alert(data.error); $('#delete_link_'+data.id) .closest('li') .slideUp('slow',function(){ $(this).remove(); }); --E...

get IIS6+ to load JSON files without server-wide change?

I've got a PHP-based web app that runs on all kinds of my customer's servers, mostly apache, but sometimes IIS. I'm using a bunch of JSON files for storing image URL data to be loaded by flash elements. Problem: IIS6+ won't load a .json file, it returns a 404 error because it's not a known mime type (why IIS doesn't recognize .json is b...

CSV to JSON script

I took this script from here: import csv from itertools import izip f = open( '/django/sw2/wkw2/csvtest1.csv', 'r' ) reader = csv.reader( f ) keys = ( "firm_url", "firm_name", "first", "last", "school", "year_graduated" ) out = [] for property in reader: property = iter( property ) data = {} for key in keys: data[ key ...

How to populate sqlite3 in django?

My plan is to collect data from websites in batches (lawyer bios from each firm's website; since they are all different, I will use a modified spider for each site) and convert each batch into a csv file; then to json; and then load it to database. So I will need to append each new file to the existing database. Please let me know how to...

Storing Ordered Child Documents/Values in CouchDB/JSON?

What is the best way to store ordered documents in CouchDB? Say I have 100 articles and I want to order them by just visibly placing them in an order I like, or I have 10,000 images and I want them to appear in a specific order other than by date/category/etc. Is this best stored at the parent ("page" or "album" level), or child (image...

JSON to Groovy parser

I found many things about converting Groovy to JSON, but oddly enough, not the other way. What is the (best) JSON to Groovy parser around there ? ...

How to substitute a javascript variable into json?

Greetings all, I have some JSON code that looks like this: { playlist: [ 'URL goes here', { // our song url: 'another URL goes here' } ] } I'd like to stick the value of a javascript variable into the JSON, and have it be substituted in place of 'URL goes here'. Is there a way to do that in JSON? ...

RESTful Service Method in WCF

I am not sure what is wrong with my JSON response from WCF but it is not being parsed properly. I probably made a simple mistake, hopefully someone can spot it. I am using VS 2008 Pro SP1. When I navigate directly to the url Chrome thinks it is a file download. When I hit say flickr's service it returned a string inline in the brow...

Populate plugin not working correctly

Hi i'm trying to retrieve and populate a form. The following link with username Testing and password test123 . The page is returning a correct JSON object (I tested it by putting on screen between paragraph tags) but the populate plugin is not populating. In firebug it show "no such element as" without displaying the element's name. The...

Is it possible to create a generic JSON parser ?

What I mean by generic is that you pass a class and a JSON to a method and that method transforms the JSON data in your object based on the class definition. I'm interested both in conceptual answers and Objective-C approaches. ...

dojox.rpc.JsonRest query Method and Zend JSON Server

I use dojo 1.3.2 with the Zend Framework 1.10 JSON Server. I can successfully execute my method getTreeByScope defined as SMD via JSON-RPC 2.0 myService.getTreeByScope({scopeId:1,nodeId:0}); this sends this POST request: {"id":1,"method":"getTreeByScope","params":{"scopeId":1,"nodeId":0},"jsonrpc":"2.0"} All is fine. Now i wanted...

Rename field in JsonSerializer

Hi, I have a class library that I need to output via a JsonResult in the ASP.NET MVC framework. (JsonResult uses the JsonSerializer to produce its output.) I discovered through reading the documentation that if you put [ScriptIgnore] on a public property/field, it will not get serialized, much like [XmlIgnore] for the XML serializer. ...

jQuery, JSON: Javascript obj/array to json for use with jQuery.ajax.

Hi All, This is a similar question to this one: http://stackoverflow.com/questions/713884/convert-js-array-to-json-object-for-use-with-jquery-ajax Except that I have an object that has several arrays in it. Object looks like (simulated): {"Users":[1,2,3,4], "Clients":[5,6,7,8], "CompletionStatus":"pastdue", "DateRange":"thisweek"} ...