json

NoSQL and REST web-services

I understand that if you use SUN's Jersey REST implementation framework, you get the ability to use XML and JSON doc's interchangably. I've tried this in a simple REST service and it works just fine, marshalling XML or JSON to Java objects and back again without any problems. My Question is this..... Whats the simplest 'NoSQL' way to p...

JSON array doesn't populate

For some reason the following JSON string creates the correct number of records in the custom objects array, but does NOT populate the objects in the array with and values. Help appreciated! JSON String { "Grids": [{ "CommitImporterGrid": {"CostDivisionCode": "DL", "CostDivisionKey": 5, "CostDivisionName": "Direct Labor", "SourceType...

building a plugin using Piwik (integrating json with piwik)

I want to build a plugin for piwik which can plot graphs by reading a json file. I want to bypass the whole process of having to acess a mysql database, is there an easy way that I could achieve this. Also I want to build a UI with standard things such as checkboxes, textfields etc, can I do that using piwik ...

iphone programming: making a MVC-styled app to parse JSON correctly?

I'm trying to create an iphone app which grabs a JSON string, parses it and displays a list of items in at table view. I'm also attempting to use an Model-View-Controller (MVC) architecture for my project. My question is in 2 parts: 1) How do I structure my different files to conform to this standard (MVC) ? 2) (more general) I've be...

Can I divide an array or string into multiple variables?

Here's where I've been: I made a PHP client call via soap to retrieve an array of data, I successfully receieved and converted my array to JSON via json_encode, I then echoed it back to my page. Here's where I am: I get back my array in this format... {"MethodName":"ID,11|1|Item1,22|2|Item2,33|3|Item3"} Here's where I want to be: Using...

Using JQuery .getJSON to read in an array

Hi, I aam trying to GET an array from a JSON file using JQuery's ajax methods. Specifically, I want to make the ajax request on document load and use the acquired data in other functions. Here is my code: $(document).ready(function() { getJSON(); clickEvents(); }); function getJSON() { $.getJSON('goods.js', function(data) { cra...

How do I loop through a JSON object that contains arrays?

How would I loop through this correctly? {names:['oscar','bill','brad'],ages:['20','25','18']} So i'd basically get the output: names: oscar ages: 20 names: bill ages: 25 names: brad ages: 18 Yes I know its a for...in loop but I just can't figure out how to get this output. ...

Array unique values

Hi Everyone, While dealing with JSON returned from YQL, I found myself looking for a way extract all unique values from an array. function uniqueArrayValues(o){ var items = o.query.results.row, output = []; function check(val){ for(var c=0; c<output.length; c++){ if(output[c] === val){ return fals...

Create a WCF service to communicate with JQuery through JSON

Hi, I have a bog standard html page. All I want to do is : use JQuery on that page to send JSON requests to a WCF service retrieve JSON back. That's it. I have the html page and JQuery written, no problem. However, I can't find one tutorial that works. All the ones I've found have many conflicting parts to do with behaviors...

PHP: JSON decoding problem

<?php $handle = fopen("https://graph.facebook.com/[email protected]&amp;type=user&amp;access_token=2227472222|2.mLWDqcUsekDYK_FQQXYnHw__.3600.1279803900-100001310000000|YxS1eGhjx2rpNYzzzzzzzLrfb5hMc.", "rb"); $json = stream_get_contents($handle); fclose($handle); echo $json; $obj = json_decode($json); print $obj->{'id'}; ?...

Serialize JSON to query string in JavaScript/jQuery

I'm trying to find information on how to serialize a JSON object to query string format, but all my searches are drowning in results on how to go the other way (string/form/whatever to JSON). I have { one: 'first', two: 'second' } and I want ?one=first&two=second Is there a good way to do this? I don't mind plugins or whatnots - i...

Setting JqGrid's colName and colModel from JSON data

I am trying to generate the list of column names and the column model on the server and feed it to JqGrid. I have successfully generated the JSON and passed it to the client over XHR, no complaints there. But, the grid itself doesn't show up. I see one column of the grid with the grid's fold/unfold button at the top. Here is the javascr...

Queue<T> DataContractJsonSerialization in Silverlight 4.0

Can anyone serialize a Queue using the DataContractJsonSerializer in Silverlight 4.0 ? Here is some example code that throws. If not what additional collections can not be serialized using the Json Serializer ? public String Serialize() { String jsonString = String.Empty; using (MemoryStream s = new MemoryStream(...

How to make an asp:panel render as a div via .RenderConrol

tl:dr version: Is there a way to get the panels to render as divs when rendered by RenderControl? Background: I am working on an asp.net 1.1 site, and I am trying to render a control containing panels to a string so I can pass it back to the page as JSON and refresh part of the page. I am rendering the control thusly: StringWriter t...

Storing Allowed Websites Per User in Postgres

Hi all, I have a User table in my Postgres database. In my application, the User can have various allowed websites. My question is: which is more disk space efficent, having a many-to-many relationship between a user and a url or storing the array in JSON in a column in the User table. Essintially, how much space does postgres use to st...

Iterating through YQL JSON results in geo.places via javascript

I'm trying to iterate through some JSON results from the YQL geo.places table using the YQL jQuery plugin (http://plugins.jquery.com/project/jquery-yql) troubleshooting with the following code; $.yql("select * from geo.places where text=#{placename}", { placename: '90210' }, function(data) { var Results = data...

Deserialize or Parse JSON from a NetworkStream using JSON.Net

Hi I am sending serialized objects via a NetWorkStream to another computer, on the receiving end I would like to deserialize these objects. I will be sending many consecutive objects, when I am receiving data via the NetworkStream, how do I know when the first JSON Document ended in order to have JSON.NET Parse the document from the re...

cant figure out this JSON string

I'm trying to use the google translate api's to... well translate some text, but its behaving strangely. When my query (the text to be translated) contains no spaces, it works fine, however as soon as I introduce a space into the query, i get no results back. This is my code: -(void)translateText:(NSString *)originalText { //Constru...

Parsing JSON from AJAX, potential man in the middle with eval?

I'm writing some AJAX; the server returns JSON (that I also wrote, and as such is sanitary JSON). Under these conditions it seems I can use eval just fine, however I worry that there may be some sort of man in the middle attack on my clients, substituting their JSON for mine. I suppose if there is a man in the middle, they can just as ea...

how to get ordinal position of element in a large json data with php

I have large json data which is contains hundreds thousands elements, now i need to get the ordinal position of an item inside the data with php. what is the best approach to do this rather than having loop because performance is important in this case. Seems PHPLINQ looks promising but performance not so good. Thanks in advanced ...