json

How can I access data from a Ruby on Rails application externally?

I'm trying to work with the data in my Rails application from within a separate Ruby script. I read this forum post in which some people suggest that the best way to work with your data is to encapsulate the database within one application, and then have this application provide an API for working with that data. Because it's apparently...

JSON output not properly parsed by JQuery?

As it stands, I have some JQuery along these lines - ph=function(i){ $.each(i,function(po){ id=po.id;url="/"+id;t=$('<div id='+ id +' class=entry></div>'); t.html('<div class=hx><a href="/users/'+ po.author +'">'+ po.author +'</a></div><div class=b>'+ po.body +'</div>'); t.prependTo($("#modpskx")); t.hide(); t.slideDown("slow");});}; fu...

How to Obtain Whole JSon file posted along with $.post in Asp.net

Hi Everyone, I am posting json data to the asp.net server page along with the $.post method. But Is there any way to obtain whole data and convert it into anon object. This is jQuery Code : var RegisterUser = function() { var _username = $("#username"); var _password = $("#password"); var _email = $("#email"); var _fir...

Marshall/Unmarshall a JSON to a Java class using JAXB

I am successfully marshaling a POJO into JSON using JAX-RS and JAXB annotations. The problem is that when I am trying to use the same for un-marshalling my request it doesn’t work. As far as I can see in the documentation JAX-RS can automatically marshal and unmarshal application/json strings back to java classes. Do I need to create m...

Json.net deseralize to a list of objects in c# .net 2.0

Hi, I'm trying to deseralize some json into a collection (list), but I'm not sure which method will return a list of objects, or do I have to loop through something and copy it to my own list? Can anyone tell me the syntax or method I should use for this. I've created my object with some properties, so it's ready to be used to hold th...

Jersey implementing ContextResolver<JAXBContext> in Spring

So I am writing a Spring(2.5( + Jersey(1.1.4.1) and trying to create a JSONConfiguration using a ContextResolver. Here is the code: package com.rhigdon.jersey.config; import com.sun.jersey.api.json.JSONConfiguration; import com.sun.jersey.api.json.JSONJAXBContext; import javax.ws.rs.ext.ContextResolver; import javax.ws.rs.ext.Provide...

ARC SPARQL Endpoint - Get results in json

Hi, can anyone help me to figure out how to get query results back in json or xml etc when using the Arc sparql endpoint? I am using the following code to get the result of my query: $endPoint->handleQueryRequest($query); $result = $endPoint->getResult(); I have looked through the code and tried passing some paramaters - trial and...

Looping javascript get requests

I've got a javascript 101 question. I'm using a nice graphing library (flot), and plotting multiple graphs on a single page. Each graph is a div, with a attribute set that tells the graph where to grab it's data from. For example, the HTML might be: <div class="line-chart" data-src='/revenue.js'></div> <div class="scatter-chart" data...

Parsing JSON like data interchange format

I'd like to use a data interchange format that uses no quotation marks. Maybe something based on JSON: {param:value,param:value,param:{[{param:value,param:value}, {param:value,param:value}]}} How should I go about parsing something like that in let's say PHP. Should do it through regular expressions? ...

efficient creation of json from mysql output - grouping within uniques

I believe I have been writing some inefficient code here, but can't seem to figure out a more efficient way of writting it. This often happens with json output, though I've had the issue with some html or xml output as well. I run a query in my database which brings back an array. Say a persons favorite foods. php's mysql_fetch_assoc...

javascript manipulate json object

For example, I have the following JSON object json_obj1 json_obj1 = {x:{id:1,bars:{show:true,barWidth:0.4}}} Now, how could I add the following object (using javascript): y:{id:2,bars:{show:true,barWidth:0.4}} to json_obj1 so that it will be: {x:{id:1,bars:{show:true,barWidth:0.4}},y:{id:2,bars:{show:true,barWidth:0.4}}} ...

Refer to an object inside an $.getJSON() with append

Hi, i try to get a json list and append it $.getJSON("url", function(data){ $('#tbl').append("<li id="listitem">asd</li>); }); It works but i cant access the li object with $("#listitem").hover( alert("Hover"); ); ` ...

JSON find in JavaScript

Is there a better way other than looping to find data in JSON? It's for edit and delete. for(var k in objJsonResp) { if (objJsonResp[k].txtId == id) { if (action == 'delete') { objJsonResp.splice(k,1); } else { objJsonResp[k] = newVal; } break; } } The data is arranged as list of maps. Like: [{id:value...

improve performance in ajax request

hello all i´m doing an ajax request using jQuery and asp.net on this way: $.ajaxSetup({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json" }); $.ajax({ url: "/WebServices/CompareDates", data: "{allClients: '" + allClients + "'}", success: function(msg) { ...

Style JSON results from a search

If I make the search: http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&amp;q=school&amp;sl=en&amp;tl=en&amp;restrict=pr%2Cde&amp;client=te I end up with a response in JSON. I am not a programmer and I have no idea where to begin to take the results and then style them and turn them into something my students can...

Is there free text editor for JSON pretty print

Is there free text editor with JSON formatting capabilities like XML Tools for Notepad++? I tested some of Adobe AIR editors and all editors are completely lack of other must have text editing features. Ideally it should be a notepad++ plugin :). ...

Passing complex data over URL with grace

I'm thinking about using something like: <script src="http://www.example.com/?key={"param":"value"}"&gt; As you can see in the example above a JSON formatted string is being passed over the src URL. The example, of course, doesn't work because both the JSON string and the script tag use double quotes. Here are a few solutions that I ...

returning JSON response to a ajax call prompts file download containing the response

i am submitting a from using jQuery ajax, and server is returning json response. but instead of the script, parsing the json result, the browser is prompting me to download the json response. I have had this problem before, where i forgot to return false at the end of the event handler. But this time im clueless why this is happening. ...

ASP.NET Javascript Converter does not seem to be invoked

I have an ASP.NET 3.5 SP1 web application that uses a custom JavaScriptConverter. The code used to work at some time in the past, but has stopped working. I do not know what changes have happened in the middle server side. The problem we are seeing now is that the converter is not being invoked, so we are getting errors that System.Da...

how to search and update JsonObject in JsonArray in an efficient approach?

JsonArray-Example: [ {"name":"table","type":"table","reportId":7,"componentId":12,"width":0,"height":0,"dataType":"DEFAULT"}, {"name":"chart","type":"chart","reportId":7,"componentId":13,"width":0,"height":0,"dataType":"DEFAULT"} ] I have to search JsonObject with Key(name,type),if jsonObject exist with the key want to ...