json

Escaping escape Characters

I'm trying to mimic the json_encode bitmask flags implemented in PHP 5.3.0, here is the string I have: $s = addslashes('O\'Rei"lly'); // O\'Rei\"lly Doing json_encode($s, JSON_HEX_APOS | JSON_HEX_QUOT) outputs the following: "O\\\u0027Rei\\\u0022lly" And I'm currently doing this in PHP versions older than 5.3.0: str_replace(array(...

converting JSON to an object / dictionary / dynamic

I'm currently using jqGrid to display data. Part of jqGrid's interface will give you search options, posting back the search details in a JSON string, for example: {"groupOp":"AND","rules":[{"field":"PersonID","op":"eq","data":"123"},{"field":"LastName","op":"eq","data":"Smith"}]} (meaning i'm searching for personID = 123, and LastNam...

Returning JSON or XML for Exceptions in Jersey

My goal is to have an error bean returned on a 404 with a descriptive message when a object is not found, and return the same MIME type that was requested. I have a look up resource, which will return the specified object in XML or JSON based on the URI (I have setup the com.sun.jersey.config.property.resourceConfigClass servlet paramet...

What is XML good for and when should i be using it?

I'm curious, I've been developing pretty powerful websites/web apps, and I've never learnt XML, even odder I've never really felt the need to. It's not like Curl or Prepared Statements where before knowing what they did and how they worked I had a feeling 'there's got to be an easier way to do this!' or 'there's got to be something desig...

jquery ui autocomplete database

Hello, I'd like to use jQuery UI autocomplete in order to load a list from my database but I don't know wich method I should use to do so. I tried to use the "Remote datasource" method http://jqueryui.com/demos/autocomplete/#remote, but it obviously doesn't work. I have the following code : js: $(function() { $("#client").autoco...

Rails - How can I display nicely indented JSON?

Hi - I have a controller action that returns JSON data for api purposes, and plenty of it. I want to be able to inspect it in the browser, and have it nicely indented for the viewer. For example, if my data is data = { :person => { :id => 1, :name => "john doe", :age => 30 }, :person => ... } I want to see { "person" : { ...

How do I parse this invalid JSON string in jQuery?

Hi, I am looking to access the various bits of data in this data attribute: <div class="location" data="{id: 4, point: {lng: -71.413364, lat: 41.673681}, category: 'Restaurant'}"> The data attribute is easy enough to reach in jQuery, of course. But the string seems to be a non-standard or invalid form of JSON. I've tried JSON.pars...

fastest public web app framework for quick DB apps?

I'd like to pick up a new tech for my toolbox - something for rapid prototyping of web apps. Brief requirements: public access (not hosted on my machine) - like Google's appengine, etc no tricky configuration necessary to build a simple web app host DB access (small storage provided) including some kind of SQLish query language easy f...

Loading google datatable using ajax/json

I can't figure out how to load a datable using ajax/json. Here is my json code in a remote file (pie.json) { cols: [{id: 'task', label: 'Task', type: 'string'}, {id: 'hours', label: 'Hours per Day', type: 'number'}], rows: [{c:[{v: 'Work'}, {v: 11}]}, {c:[{v: 'Eat'}, {v: 2}]}, ...

How can I force a property of an object to be output as a string when returned as JSON

I'm storing color values as HEX in my database, which is mapped via ORM settings in CF9. When my color values are entirely numeric (e.g. 000000), ColdFusion is serializing them as numbers (e.g. 0.0) when returned from my CFC as JSON. Is there a way to force these columns/properties to be serialized as strings? ...

How to JSON serialize math vector type in F#?

Hello! I'm trying to serialize "vector" (Microsoft.FSharp.Math) type. And I get that error: Exception Details: System.Runtime.Serialization.SerializationException: Type 'Microsoft.FSharp.Math.Instances+FloatNumerics@115' with data contract name 'Instances.FloatNumerics_x0040_115:http://schemas.datacontract.org/2004/07/Microsoft.FSh...

Xstream giving different results

We are using XStream for our restful services. However, Xstream gives us varying results for fields with the same values. assume it Book object: public class Book{ public String name "myName"; public Listauthors = new List(); public String subject "mySubject"; public Book(){ } } The json for this is: {"Book":{"name":"myName", "a...

Can a Google Search Appliance / Mini output JSON/JSONP?

Using Google Mini for a website that needs output from the Google Mini in a JSON/JSONP format for front-end querying purposes. Google Mini does publish an XML feed that could potentially be used by a middle process to convert to JSON/JSONP. Can Google Search Appliance / Mini output to JSON/JSONP using a plug-in, modification to an XSLT ...

JSON bitmap data

Is it possible, or reasonable, to encode bitmap data into JSON to be returned in a webservice? Update: Yes, this worked better than I thought. I made a .NET composite object for a combination of images together with image data Public Class AllThumbnails Public imgAllThumbs As String Public positions() As Drawing.Recta...

How can I send null value?

I want to do something like this $.get('/Controller/Action/', { model : null }, function(data) {}); Unfortunatelly it doesn't work. In server side the value of the model is {object}. How do I get null? EDIT --- Javascript --- var json = JSON.stringify({ model: null }); $.get('/Controller/Action/', json, function (data) { }); -...

what is the use of json in .net

Can someone explain what is json method and it use in .net ...

API for Posting Photos to Panoramio

Hi! Is there any api that able to post photo on Panoramio? ...

DataContractJsonSerializer generating Ghost string to JSON keys?

DataContractJsonSerializer this is nice class added in the .net framework which can be used to serialize/desirealize object into JSON. Now following is the example i am trying [Serializable] class User { public string name; public string userId; } Now following is the output generated Output : Notice structure where only "name"...

Delphi Superobject, generic list to json

I have a object with some TObjectList<>-fields that I try to encode as JSON with help form SuperObject. TLogs = TObjectList<TLog>; TMyObject = class(TObject) private FLogs: TLogs; end; Deep inside SuperObjects code, there is a ToClass procedure, iterating the fields and add them to the json result. In this loop, there is a check on...

jQuery JSON encode set of input values

I need tp serialize a group of input elements but I can't for the life of me figure out this simple task. I can successfully iterate through the targeted inputs using: $("#tr_Features :input").each(function() { ... } Here's my code, that doesn't work: var features = ""; $("#tr_Features :input").each(function() { features += ...