json

Send error message as JSON object

I have two servlet: first servlet is similar to a client and creates an HttpURLConnection to call the second servlet. I would like send a special error, formatted like a JSON object, so I call sendError method in this way: response.sendError(code, "{json-object}") But in the first servlet when I read error with getResponseMessage me...

How do I get an ExtJS JsonStore to put the JSON data directly into the request body?

I have a JsonStore configured like so: var store = new Ext.data.JsonStore({ restful: true, url: '/categories', remoteSort: true, idProperty: 'Id', totalProperty: 'total', root: 'results', writer: new Ext.data.JsonWriter({ encode: false }), fields: [ 'Id', 'Name' ] }); I grab some data from ...

Add JSON support to Rails app

I am experimenting with Rails and was wondering what's needed to allow/add support for JSON requests? I have a vanilla installation of Rails 2.3.5 and the default scaffolding seem to provide support for HTML & XML requests but not JSON. class EventsController < ApplicationController # GET /events # GET /events.xml def index @...

How to send an array(multidimensional/associative) and some varaibles together through json?

i have an multidimensional array $ouptput=Array ( [0] => Array ( [0] => mov_1 [1] => MY FAIR LADY ) [1] => Array ( [1] => mov_10 [2] => love actually ) ) and two variables $avlblQnty=50 $su...

How to retrieve key and value from JSON String

I have a JSON String in this format: { "supplier": { "mov_10": "love actually", "mov_1": "fare" }, "quantity": 20, "success": true, "length":2 } Now I want to create a select box below using the supplier object (using both the keys and values), like this: <select id="selectme"> <option id="mov_10">love actually<...

gMaps suddenly stopped working : Can't find variable: G_NORMAL_MAP

hello! i inject a map on my div called "concessionario-map" with GMap, a jquery plugin. Gmap everything works fine until this morning. now the debugger says: ReferenceError: Can't find variable: G_NORMAL_MAP i just search on google and i read some similar situation, but i dont find a case like mine. please, can you help me? thanks a l...

querying larg text file containing JSON objects.

Hi, I have few Gigabytes text file in format: {"user_ip":"x.x.x.x", "action_type":"xxx", "action_data":{"some_key":"some_value"...},...} each entry is one line. First I would like to easily find entries for given ip. This part is easy because I can use grep for example. However even for this I would like to find better solution because...

What's the proper and reliable way to store an XML string as a JSON property?

I want to store a string which itself is an XML string as a property of an JSON object , what's the reliable and proper way of dong this? Should I first encode the XML data into BASE64 first prior saving it to an JSON object, due to the fact that JSON does not support binary data? Example of data I want to store: { "string1" : "<xml...

jquery trouble with getJSON call.

Hi guys. Got some basic problem again. I need to modify a function that previously returned a in code written object. Im now trying to get the object from json through $.getJSON function getEventData() { var result = ''; $.getJSON("ajax.php?cmd=getbydate&fromdate=&todate=", function(data){ result = data; ...

string to JsonObject in C#

What is the best way to convert a (properly Json-formatted) String object into a System.Json.JsonObject? Right now I create a StringReader and use System.Json.JsonObject.Load. (This is really kind of academic, since I think I'll always be dealing with the raw Json in System.IO.Stream form.) ...

json encodes aray

Okay I have been struggling with this for hours. What I am doing is creating array of what I call objects that can be moved around on a calendar. Below is my code $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' => 111, 'title' => "Event3", 'start' => "$year-$month-10", '...

Can't get jQuery AutoComplete to work with External JSON

I'm working on an ASP.NET app where I'm in need of jQuery AutoComplete. Currently there is nothing happening when I type data into the txt63 input box (and before you flame me for using a name like txt63, I know, I know... but it's not my call :D ). Here's my javascript code <script src="http://ajax.googleapis.com/ajax/libs/jq...

Custom JsonSerialization

Hi, I have a simple class in asp.net mvc that looks like this: public class JsonResponseItem { public string Key { get; set; } public string Value { get; set; } public JsonResponseItem(string key, string value) { Key = key; Value = value; } } In my controllers I create a list of that type Li...

Html, handling a JSON response

I have a page that comes back as an UnexpectedPage in HtmlUnit, the response is JSON. Can I use HTMLUnit to parse this or will I need an additional library? ...

What are good CLI tools for JSON?

General Problem Though I may be diagnosing the root cause of an event, determining how many users it affected, or distilling timing logs in order to assess the performance and throughput impact of a recent code change, my tools stay the same: grep, awk, sed, tr, uniq, sort, zcat, tail, head, join, and split. To glue them all together, U...

use AMF instead of JSON on iPhone? (for web services)

Although iPhone support JSON natively, AMF is a binary protocol and it supposes to use much less bandwidth. Do you think using AMF is a good idea? Just found this AMF library in cocoa (Objective-C): http://github.com/nesium/cocoa-amf/ Here's the famous benchmark that shows AMF is smaller and faster than JSON + gzip in Flex: http://www...

Add autoFill capabilities to jQuery-UI 1.8.1

here's what I currently have, unfortunately I cannot seem to figure out how to get autoFill to work with jQuery-UI... It used to work with the straight up Autocomplete.js <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery...

Extjs - Getting more from the server

Hi, Is it possible to get every data from the server? for example, i want to get the columns items from the server Via Ajax/Proxy by sending json string? thanks var grid = new Ext.grid.GridPanel({ store: store, columns: [ {id:'company',header: 'Company', width: 160, sortable: true, dataIndex: 'company'}, {header: 'Price', width: 75, so...

convert json string into array or object...

I get some json data form the web which is like: [{"pk": 1, "model": "stock.item", "fields": {"style": "f/s", "name": "shirt", "color": "red", "sync": 1, "fabric_code": "0012", "item_code": "001", "size": "34"}}, {"pk": 2, "model": "stock.item", "fields": {"style": "febric", "name": "Trouser", "color": "red", "sync": 1, "fabric_code": "...

How do I output JSON columns in jQuery

I'm using the qTip jQuery plugin to create dynamic tool tips. The tooltip sends an id to a cfc which runs a query and returns data in JSON format. At the moment, the tooltip loads with the following: {"COLUMNS:" ["BOOKNAME","BOOKDESCRIPTION"["MYBOOK","MYDESC"]]} Here's the jQuery $('#catalog a[href]').each(function() { var gi =...